def _execute_workflow(self, deployment_update, workflow_id, parameters=None, allow_custom_parameters=False, force=False): """Executes the specified workflow :param deployment_update: :param workflow_id: :param parameters: :param allow_custom_parameters: :param force: :return: """ deployment_id = deployment_update.deployment_id deployment = self.sm.get(models.Deployment, deployment_id) blueprint_id = deployment.blueprint_id if workflow_id not in deployment.workflows: raise manager_exceptions.NonexistentWorkflowError( 'Workflow {0} does not exist in deployment {1}' .format(workflow_id, deployment_id)) workflow = deployment.workflows[workflow_id] execution_parameters = \ ResourceManager._merge_and_validate_execution_parameters( workflow, workflow_id, parameters, allow_custom_parameters) execution_id = str(uuid.uuid4()) new_execution = models.Execution( id=execution_id, status=ExecutionState.PENDING, created_at=utils.get_formatted_timestamp(), workflow_id=workflow_id, error='', parameters=ResourceManager._get_only_user_execution_parameters( execution_parameters), is_system_workflow=False) if deployment: new_execution.set_deployment(deployment) deployment_update.execution = new_execution self.sm.put(new_execution) # executing the user workflow workflow_plugins = \ deployment_update.deployment_plan[ constants.WORKFLOW_PLUGINS_TO_INSTALL] workflow_executor.execute_workflow( workflow_id, workflow, workflow_plugins=workflow_plugins, blueprint_id=blueprint_id, deployment_id=deployment_id, execution_id=execution_id, execution_parameters=execution_parameters) return new_execution
def _execute_workflow(self, deployment_update, workflow_id, parameters=None, allow_custom_parameters=False): deployment = deployment_update.deployment if workflow_id not in deployment.workflows: raise manager_exceptions.NonexistentWorkflowError( 'Workflow {0} does not exist in deployment {1}'.format( workflow_id, deployment.id)) workflow = deployment.workflows[workflow_id] execution_parameters = \ ResourceManager._merge_and_validate_execution_parameters( workflow, workflow_id, parameters, allow_custom_parameters) execution_id = str(uuid.uuid4()) new_execution = models.Execution( id=execution_id, status=ExecutionState.PENDING, created_at=utils.get_formatted_timestamp(), workflow_id=workflow_id, error='', parameters=ResourceManager._get_only_user_execution_parameters( execution_parameters), is_system_workflow=False ) if deployment: new_execution.set_deployment(deployment) deployment_update.execution = new_execution self.sm.put(new_execution) # executing the user workflow workflow_plugins = deployment_update.deployment_plan[ constants.WORKFLOW_PLUGINS_TO_INSTALL] workflow_executor.execute_workflow( workflow_id, workflow, workflow_plugins=workflow_plugins, blueprint_id=deployment.blueprint_id, deployment_id=deployment.id, execution_id=execution_id, execution_parameters=execution_parameters, execution_creator=current_user ) return new_execution