def execute_step(self, **data): handler_data = validate_handler_data(self.handler, data) new_data = self.handler(self.flow, **handler_data) if new_data: data.update(new_data) if self.step.next_step is None: return new_data return data
def execute_step(self, **data): """ :param data: next step data :param last_step: Step object or step_key value :return: Flow result """ # if 'self_step' in data: # raise RuntimeError("You can't use 'self_step' var in data") handler_data = utils.validate_handler_data(self.handler, data) result_data = self.handler(**handler_data) session.set_flow_data(result_data) return result_data
def run_component(self, data): data = validate_handler_data(self.component, data) try: self.on_component_called_signal.send_signal(name=self.name) component_result = self.component(**data) self.on_component_finished_signal.send_signal(name=self.name) except StopPipelineFlag as e: raise StopFlowFlag(e) except TypeError as e: msg = "%s on component: %s on method/class: %s" logger.error(msg % (str(e), self.name, str(self.component))) raise if self.key_wrapper is not None: component_result = {self.key_wrapper: component_result} return component_result
def __call__(self, **kwargs): handler_data = validate_handler_data(self.handler, kwargs) result = self.handler(**handler_data) call_next_step(result, self.step)
def __call__(self, *args, **kwargs): kwargs = validate_handler_data(self.handler, kwargs) return self.handler(*args, **kwargs)
def call_by_condition(self, data): statement_data = validate_handler_data(self.statement, data) if self.statement(**statement_data): self.do_pipeline.add_job(data) else: self.otherwise_pipeline.add_job(data)
def __call__(self, **data): data = validate_handler_data(self.handler, data) output_result = self.handler(**data) if not self.as_worker: return output_result
def run_on_when_handler(self, data): when_data = validate_handler_data(self.when_handler, data) return self.when_handler(**when_data)