def update_workflows(definition, scope='private', identifier=None): wf_list_spec = spec_parser.get_workflow_list_spec_from_yaml(definition) wfs = wf_list_spec.get_workflows() if identifier and len(wfs) > 1: raise exc.InputException( "More than one workflows are not supported for update with UUID " "provided.") db_wfs = [] with db_api.transaction(): for wf_spec in wf_list_spec.get_workflows(): db_wfs.append( _update_workflow(wf_spec, definition, scope, identifier=identifier)) # Once transaction has committed we need to update specification cache. for db_wf, wf_spec in zip(db_wfs, wf_list_spec.get_workflows()): spec_parser.update_workflow_cache(db_wf.id, wf_spec) return db_wfs
def update_workflows(definition, scope='private', identifier=None): wf_list_spec = spec_parser.get_workflow_list_spec_from_yaml(definition) wfs = wf_list_spec.get_workflows() if identifier and len(wfs) > 1: raise exc.InputException( "More than one workflows are not supported for update with UUID " "provided." ) db_wfs = [] with db_api.transaction(): for wf_spec in wf_list_spec.get_workflows(): db_wfs.append(_update_workflow( wf_spec, definition, scope, identifier=identifier )) # Once transaction has committed we need to update specification cache. for db_wf, wf_spec in zip(db_wfs, wf_list_spec.get_workflows()): spec_parser.update_workflow_cache(db_wf.id, wf_spec) return db_wfs
def test_get_controller_reverse(self): wf_spec = spec_parser.get_workflow_list_spec_from_yaml(REVERSE_WF)[0] wf_ex = db_models.WorkflowExecution(spec=wf_spec.to_dict()) self.assertIsInstance( wf_base.get_controller(wf_ex, wf_spec), reverse_wf.ReverseWorkflowController )
def test_get_controller_direct(self): wf_spec = spec_parser.get_workflow_list_spec_from_yaml(DIRECT_WF)[0] wf_ex = db_models.WorkflowExecution(spec=wf_spec.to_dict()) self.assertIsInstance( wf_base.get_controller(wf_ex, wf_spec), direct_wf.DirectWorkflowController )
def create_workflows(definition, scope='private'): wf_list_spec = spec_parser.get_workflow_list_spec_from_yaml(definition) db_wfs = [] with db_api.transaction(): for wf_spec in wf_list_spec.get_workflows(): db_wfs.append(_create_workflow(wf_spec, definition, scope)) return db_wfs
def update_workflows(definition, scope='private'): wf_list_spec = spec_parser.get_workflow_list_spec_from_yaml(definition) db_wfs = [] with db_api.transaction(): for wf_spec in wf_list_spec.get_workflows(): db_wfs.append(_update_workflow(wf_spec, definition, scope)) return db_wfs
def _prepare_test(self, wf_text): wf_spec = spec_parser.get_workflow_list_spec_from_yaml(wf_text)[0] wf_ex = models.WorkflowExecution() wf_ex.update({ 'id': '1-2-3-4', 'spec': wf_spec.to_dict(), 'state': states.RUNNING }) self.wf_ex = wf_ex self.wf_spec = wf_spec self.wf_ctrl = d_wf.DirectWorkflowController(wf_ex)
def _prepare_test(self, wf_text): wf_spec = spec_parser.get_workflow_list_spec_from_yaml(wf_text)[0] wf_ex = models.WorkflowExecution() wf_ex.update({ 'id': '1-2-3-4', 'spec': wf_spec.to_dict(), 'state': states.RUNNING }) self.wf_ex = wf_ex self.wf_spec = wf_spec self.wf_ctrl = d_wf.DirectWorkflowController(wf_ex)
def create_workflows(definition, scope='private', is_system=False, run_in_tx=True): wf_list_spec = spec_parser.get_workflow_list_spec_from_yaml(definition) db_wfs = [] if run_in_tx: with db_api.transaction(): _append_all_workflows(definition, is_system, scope, wf_list_spec, db_wfs) else: _append_all_workflows(definition, is_system, scope, wf_list_spec, db_wfs) return db_wfs
def update_workflows(definition, scope='private', identifier=None): wf_list_spec = spec_parser.get_workflow_list_spec_from_yaml(definition) wfs = wf_list_spec.get_workflows() if identifier and len(wfs) > 1: raise exc.InputException( "More than one workflows are not supported for " "update with identifier. [identifier: %s]" % identifier) db_wfs = [] with db_api.transaction(): for wf_spec in wf_list_spec.get_workflows(): db_wfs.append( _update_workflow(wf_spec, definition, scope, identifier=identifier)) return db_wfs
def update_workflows(definition, scope='private', identifier=None): wf_list_spec = spec_parser.get_workflow_list_spec_from_yaml(definition) wfs = wf_list_spec.get_workflows() if identifier and len(wfs) > 1: raise exc.InputException( "More than one workflows are not supported for update with UUID " "provided." ) db_wfs = [] with db_api.transaction(): for wf_spec in wf_list_spec.get_workflows(): db_wfs.append(_update_workflow( wf_spec, definition, scope, identifier=identifier )) return db_wfs
def create_workflows(definition, scope='private', is_system=False, run_in_tx=True): wf_list_spec = spec_parser.get_workflow_list_spec_from_yaml(definition) db_wfs = [] if run_in_tx: with db_api.transaction(): _append_all_workflows( definition, is_system, scope, wf_list_spec, db_wfs ) else: _append_all_workflows( definition, is_system, scope, wf_list_spec, db_wfs ) return db_wfs
def test_get_controller_reverse(self): wf_spec = spec_parser.get_workflow_list_spec_from_yaml(REVERSE_WF)[0] wf_ex = db_models.WorkflowExecution(spec=wf_spec.to_dict()) self.assertIsInstance(wf_base.get_controller(wf_ex, wf_spec), reverse_wf.ReverseWorkflowController)
def test_get_controller_direct(self): wf_spec = spec_parser.get_workflow_list_spec_from_yaml(DIRECT_WF)[0] wf_ex = db_models.WorkflowExecution(spec=wf_spec.to_dict()) self.assertIsInstance(wf_base.get_controller(wf_ex, wf_spec), direct_wf.DirectWorkflowController)