本文整理汇总了Python中pyasm.biz.Task.get_by_sobjects方法的典型用法代码示例。如果您正苦于以下问题:Python Task.get_by_sobjects方法的具体用法?Python Task.get_by_sobjects怎么用?Python Task.get_by_sobjects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.biz.Task
的用法示例。
在下文中一共展示了Task.get_by_sobjects方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_as_approved
# 需要导入模块: from pyasm.biz import Task [as 别名]
# 或者: from pyasm.biz.Task import get_by_sobjects [as 别名]
def set_as_approved(my):
'''convinience function that sets task for this process as approved'''
my.set_event_name("task/approved")
# get the task associated with this process
tasks = Task.get_by_sobjects(my.sobjects, my.process_name)
for task in tasks:
task.set_value("status", "Approved")
task.commit()
示例2: preprocess
# 需要导入模块: from pyasm.biz import Task [as 别名]
# 或者: from pyasm.biz.Task import get_by_sobjects [as 别名]
def preprocess(my):
# get the tasks and reorder by search_key
tasks = Task.get_by_sobjects(my.sobjects)
my.tasks_dict = {}
for task in tasks:
search_type = task.get_value("search_type")
search_id = task.get_value("search_id")
search_key = "%s|%s" % (search_type, search_id)
sobject_tasks = my.tasks_dict.get(search_key)
if not sobject_tasks:
sobject_tasks = []
my.tasks_dict[search_key] = sobject_tasks
sobject_tasks.append(task)
示例3: preprocess
# 需要导入模块: from pyasm.biz import Task [as 别名]
# 或者: from pyasm.biz.Task import get_by_sobjects [as 别名]
def preprocess(my):
if my.sobjects:
tasks = Task.get_by_sobjects(my.sobjects, my.process_names)
# create a data structure
for task in tasks:
search_type = task.get_value("search_type")
search_id = task.get_value("search_id")
search_key = "%s|%s" % (search_type, search_id)
sobject_tasks = my.data.get(search_key)
if not sobject_tasks:
sobject_tasks = []
my.data[search_key] = sobject_tasks
sobject_tasks.append(task)
status_attr = task.get_attr("status")
process_count = len(status_attr.get_pipeline().get_processes())
if process_count > my.max_count:
my.max_count = process_count
示例4: get_display
# 需要导入模块: from pyasm.biz import Task [as 别名]
# 或者: from pyasm.biz.Task import get_by_sobjects [as 别名]
def get_display(self):
sobject = self.get_current_sobject()
shots = sobject.get_all_children("prod/shot")
task_dict = {}
tasks = Task.get_by_sobjects(shots)
for task in tasks:
search_type = task.get_value("search_type")
search_id = task.get_value("search_id")
key = '%s|%s' % (search_type, search_id)
task_array = task_dict.get(key)
if not task_array:
task_array = []
task_dict[key] = task_array
task_array.append(task)
# TODO: get rid of this hard code
approved = ['Complete', 'Approved', 'Final']
widget = Widget()
total = 0
completion = {}
# get all of the tasks in a shot
for shot in shots:
key = shot.get_search_key()
tasks = task_dict.get(key)
if not tasks:
tasks = []
frame_range = shot.get_frame_range()
frames = frame_range.get_num_frames()
total += frames
is_complete = {}
for task in tasks:
process = task.get_value("process")
status = task.get_value("status")
if not completion.get(process):
completion[process] = 0
if status not in approved:
is_complete[process] = False
elif not is_complete.get(process):
is_complete[process] = True
# only set to true, if no other process has set it to false
elif is_complete.get(process) != False:
is_complete[process] = True
for process, flag in is_complete.items():
if flag:
completion[process] += frames
table = Table(css="minimal")
table.add_style("width: 100%")
processes = completion.keys()
table.add_row()
for process in processes:
time = self.convert_to_time(completion[process])
td = table.add_cell("%s (%s)" % (time, completion[process]))
if completion[process] == 0:
td.add_style("color: #ccc")
table.add_cell("%s (%s)" % (self.convert_to_time(total), total) )
table.add_row_cell("<hr size='1'/>")
table.add_row()
for process in processes:
td = table.add_cell("%s" % process)
if completion[process] == 0:
td.add_style("color: #ccc")
table.add_cell("total")
widget.add(table)
return widget