def _create_workflow_execution(wf_def, wf_spec, wf_input, desc, params): wf_ex = db_api.create_workflow_execution({ 'name': wf_def.name, 'description': desc, 'workflow_name': wf_def.name, 'workflow_id': wf_def.id, 'spec': wf_spec.to_dict(), 'params': params or {}, 'state': states.IDLE, 'input': wf_input or {}, 'output': {}, 'context': copy.deepcopy(wf_input) or {}, 'task_execution_id': params.get('task_execution_id'), 'runtime_context': { 'with_items_index': params.get('with_items_index', 0) }, }) data_flow.add_openstack_data_to_context(wf_ex) data_flow.add_execution_to_context(wf_ex) data_flow.add_environment_to_context(wf_ex) data_flow.add_workflow_variables_to_context(wf_ex, wf_spec) return wf_ex
def _create_execution(self, input_dict, desc, params): self.wf_ex = db_api.create_workflow_execution({ 'name': self.wf_def.name, 'description': desc, 'workflow_name': self.wf_def.name, 'workflow_id': self.wf_def.id, 'spec': self.wf_spec.to_dict(), 'state': states.IDLE, 'output': {}, 'task_execution_id': params.get('task_execution_id'), 'runtime_context': { 'index': params.get('index', 0) }, }) self.wf_ex.input = input_dict or {} self.wf_ex.context = copy.deepcopy(input_dict) or {} env = _get_environment(params) if env: params['env'] = env self.wf_ex.params = params data_flow.add_openstack_data_to_context(self.wf_ex) data_flow.add_execution_to_context(self.wf_ex) data_flow.add_environment_to_context(self.wf_ex) data_flow.add_workflow_variables_to_context(self.wf_ex, self.wf_spec)
def update_workflow_execution_env(wf_ex, env): if not env: return wf_ex if wf_ex.state not in [states.IDLE, states.PAUSED, states.ERROR]: raise exc.NotAllowedException( 'Updating env to workflow execution is only permitted if ' 'it is in IDLE, PAUSED, or ERROR state.') wf_ex.params['env'] = utils.merge_dicts(wf_ex.params['env'], env) data_flow.add_environment_to_context(wf_ex) return wf_ex
def update_workflow_execution_env(wf_ex, env): if not env: return wf_ex if wf_ex.state not in [states.IDLE, states.PAUSED, states.ERROR]: raise exc.NotAllowedException( 'Updating env to workflow execution is only permitted if ' 'it is in IDLE, PAUSED, or ERROR state.' ) wf_ex.params['env'] = utils.merge_dicts(wf_ex.params['env'], env) data_flow.add_environment_to_context(wf_ex) return wf_ex
def _create_workflow_execution(wf_def, wf_spec, wf_input, params): wf_ex = db_api.create_workflow_execution({ 'name': wf_def.name, 'workflow_name': wf_def.name, 'spec': wf_spec.to_dict(), 'params': params or {}, 'state': states.RUNNING, 'input': wf_input or {}, 'output': {}, 'context': copy.copy(wf_input) or {}, 'task_execution_id': params.get('task_execution_id'), 'runtime_context': { 'with_items_index': params.get('with_items_index', 0) }, }) data_flow.add_openstack_data_to_context(wf_ex.context) data_flow.add_execution_to_context(wf_ex, wf_ex.context) data_flow.add_environment_to_context(wf_ex, wf_ex.context) return wf_ex