def evaluate_workflow_final_context(self): return data_flow.evaluate_task_outbound_context( wf_utils.find_task_execution( self.wf_ex, self._get_target_task_specification() ) )
def defer_task(wf_cmd): """Defers a task""" ctx = wf_cmd.ctx wf_ex = wf_cmd.wf_ex task_spec = wf_cmd.task_spec if not wf_utils.find_task_execution(wf_ex, task_spec): _create_task_execution(wf_ex, task_spec, ctx, state=states.WAITING)
def _has_outbound_tasks(self, task_ex): t_specs = self._find_outbound_task_specs( self.wf_spec.get_tasks()[task_ex.name] ) return any( [wf_utils.find_task_execution(self.wf_ex, t_s) for t_s in t_specs] )
def _triggers_join(self, join_task_spec, inbound_task_spec): in_t_ex = wf_utils.find_task_execution(self.wf_ex, inbound_task_spec) if not in_t_ex or not states.is_completed(in_t_ex.state): return False return filter( lambda t_name: join_task_spec.get_name() == t_name, self._find_next_task_names( in_t_ex, data_flow.evaluate_task_outbound_context(in_t_ex)))
def _triggers_join(self, join_task_spec, inbound_task_spec): in_t_ex = wf_utils.find_task_execution(self.wf_ex, inbound_task_spec) if not in_t_ex or not states.is_completed(in_t_ex.state): return False return filter( lambda t_name: join_task_spec.get_name() == t_name, self._find_next_task_names(in_t_ex, data_flow.evaluate_task_outbound_context(in_t_ex)), )
def _is_satisfied_task(self, task_spec): task_ex = wf_utils.find_task_execution(self.wf_ex, task_spec) if task_ex: return False if not self._get_task_requires(task_spec): return True success_t_names = set() for t_ex in self.wf_ex.task_executions: if t_ex.state == states.SUCCESS: success_t_names.add(t_ex.name) return not (set(self._get_task_requires(task_spec)) - success_t_names)
def _is_satisfied_task(self, task_spec): task_requires = self._get_task_requires(task_spec) for req in task_requires: if not self._task_exists(req): raise exc.WorkflowException( "Task '%s' not found." % req ) task_ex = wf_utils.find_task_execution(self.wf_ex, task_spec) if task_ex: return False if not self._get_task_requires(task_spec): return True success_t_names = set() for t_ex in self.wf_ex.task_executions: if t_ex.state == states.SUCCESS: success_t_names.add(t_ex.name) return not (set(self._get_task_requires(task_spec)) - success_t_names)
def _has_outbound_tasks(self, task_ex): t_specs = self._find_outbound_task_specs( self.wf_spec.get_tasks()[task_ex.name]) return any( [wf_utils.find_task_execution(self.wf_ex, t_s) for t_s in t_specs])
def _is_started_join(self, cmd): if not isinstance(cmd, commands.RunTask): return False return (cmd.task_spec.get_join() and wf_utils.find_task_execution(self.wf_ex, cmd.task_spec))