def GraphExtender(_): task_module.ExtendTaskGraph(self.job, vertices=[], dependencies=[ task_module.Dependency( from_='unknown', to=task.id) ])
def __call__(self, accumulator): # Outline: # - Given the job and task, extend the TaskGraph to add new tasks and # dependencies, being careful to filter the IDs from what we already see # in the accumulator to avoid graph amendment errors. # - If we do encounter graph amendment errors, we should log those and not # block progress because that can only happen if there's concurrent # updates being performed with the same actions. build_option_template = BuildOptionTemplate( **self.task.payload.get('build_option_template')) test_option_template = TestOptionTemplate( **self.task.payload.get('test_option_template')) # The ReadOptionTemplate is special because it has nested structures, so # we'll have to reconstitute those accordingly. read_option_template_map = self.task.payload.get( 'read_option_template') read_option_template = ReadOptionTemplate( benchmark=self.task.payload.get('read_option_template').get( 'benchmark'), histogram_options=read_value.HistogramOptions( **read_option_template_map.get('histogram_options')), graph_json_options=read_value.GraphJsonOptions( **read_option_template_map.get('graph_json_options')), mode=read_option_template_map.get('mode')) analysis_options_dict = self.task.payload.get('analysis_options') if self.additional_attempts: analysis_options_dict['min_attempts'] = min( analysis_options_dict.get('min_attempts', 0) + self.additional_attempts, analysis_options_dict.get('max_attempts', 100)) analysis_options = AnalysisOptions(**analysis_options_dict) new_subgraph = read_value.CreateGraph( _CreateReadTaskOptions(build_option_template, test_option_template, read_option_template, analysis_options, self.change, self.task.payload.get('arguments', {}))) try: task_module.ExtendTaskGraph( self.job, vertices=[ # Add all of the new vertices we do not have in the graph yet. v for v in new_subgraph.vertices if v.id not in accumulator ], dependencies=[ # Only add dependencies to the new 'read_value' tasks. task_module.Dependency(from_=self.task.id, to=v.id) for v in new_subgraph.vertices if v.id not in accumulator and v.vertex_type == 'read_value' ]) except task_module.InvalidAmendment as e: logging.error('Failed to amend graph: %s', e)
def GraphExtender(_): task_module.ExtendTaskGraph( self.job, vertices=[ task_module.TaskVertex(id=task.id, vertex_type='duplicate', payload={}) ], dependencies=[ task_module.Dependency(from_='task_2', to=task.id) ])
def GraphExtender(_): logging.debug('New revisions: %s', new_positions) task_module.ExtendTaskGraph(job, [ task_module.TaskVertex(id='rev_%s' % (rev, ), vertex_type='revision', payload={ 'revision': '%s' % (rev, ), 'position': rev }) for rev in new_positions ], [ task_module.Dependency(from_='bisection', to='rev_%s' % (rev, )) for rev in new_positions ])