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()
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()
def preprocess(self): # get the tasks and reorder by search_key tasks = Task.get_by_sobjects(self.sobjects) self.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 = self.tasks_dict.get(search_key) if not sobject_tasks: sobject_tasks = [] self.tasks_dict[search_key] = sobject_tasks sobject_tasks.append(task)
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)
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
def preprocess(self): if self.sobjects: tasks = Task.get_by_sobjects(self.sobjects, self.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 = self.data.get(search_key) if not sobject_tasks: sobject_tasks = [] self.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 > self.max_count: self.max_count = process_count
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
def get_display(my): sobject = my.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 = my.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)" % (my.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