def start_action(self, action_name, action_input, description=None, **params): with db_api.transaction(): action_def = action_handler.resolve_definition(action_name) resolved_action_input = action_handler.get_action_input( action_name, action_input) action = a_m.get_action_class( action_def.name)(**resolved_action_input) # If we see action is asynchronous, then we enforce 'save_result'. if params.get('save_result') or not action.is_sync(): action_ex = action_handler.create_action_execution( action_def, resolved_action_input, description=description) action_handler.run_action(action_def, resolved_action_input, action_ex.id, params.get('target')) return action_ex.get_clone() else: output = action_handler.run_action(action_def, resolved_action_input, target=params.get('target'), async=False) return db_models.ActionExecution(name=action_name, description=description, input=action_input, output=output)
def _get_action_input(wf_spec, task_ex, task_spec, ctx): input_dict = expr.evaluate_recursively(task_spec.get_input(), ctx) action_spec_name = task_spec.get_action_name() input_dict = utils.merge_dicts(input_dict, _get_action_defaults(task_ex, task_spec), overwrite=False) return action_handler.get_action_input(action_spec_name, input_dict, task_ex.workflow_name, wf_spec)
def _get_action_input(wf_spec, task_ex, task_spec, ctx): input_dict = expr.evaluate_recursively(task_spec.get_input(), ctx) action_spec_name = task_spec.get_action_name() input_dict = utils.merge_dicts( input_dict, _get_action_defaults(task_ex, task_spec), overwrite=False ) return action_handler.get_action_input( action_spec_name, input_dict, task_ex.workflow_name, wf_spec )
def start_action(self, action_name, action_input, description=None, **params): with db_api.transaction(): action_def = action_handler.resolve_definition(action_name) resolved_action_input = action_handler.get_action_input( action_name, action_input ) action = a_m.get_action_class(action_def.name)( **resolved_action_input ) # If we see action is asynchronous, then we enforce 'save_result'. if params.get('save_result') or not action.is_sync(): action_ex = action_handler.create_action_execution( action_def, resolved_action_input, description=description ) action_handler.run_action( action_def, resolved_action_input, action_ex.id, params.get('target') ) return action_ex.get_clone() else: output = action_handler.run_action( action_def, resolved_action_input, target=params.get('target'), async=False ) return db_models.ActionExecution( name=action_name, description=description, input=action_input, output=output )