Exemplo n.º 1
0
    def resume(self, env=None):
        """Resume workflow.

        :param env: Environment.
        """

        assert self.wf_ex

        wf_service.update_workflow_execution_env(self.wf_ex, env)

        self.set_state(states.RUNNING)

        wf_ctrl = wf_base.get_controller(self.wf_ex)

        # Calculate commands to process next.
        cmds = wf_ctrl.continue_workflow()

        self._continue_workflow(cmds)

        # If workflow execution is a subworkflow,
        # schedule update to the task execution.
        if self.wf_ex.task_execution_id:
            # Import the task_handler module here to avoid circular reference.
            from mistral.engine import task_handler

            task_handler.schedule_on_action_update(self.wf_ex)
Exemplo n.º 2
0
    def resume(self, env=None):
        """Resume workflow.

        :param env: Environment.
        """

        assert self.wf_ex

        wf_service.update_workflow_execution_env(self.wf_ex, env)

        self.set_state(states.RUNNING)

        # Publish event.
        self.notify(events.WORKFLOW_RESUMED)

        wf_ctrl = wf_base.get_controller(self.wf_ex)

        # Calculate commands to process next.
        cmds = wf_ctrl.continue_workflow()

        self._continue_workflow(cmds)

        # If workflow execution is a subworkflow,
        # schedule update to the task execution.
        if self.wf_ex.task_execution_id:
            # Import the task_handler module here to avoid circular reference.
            from mistral.engine import task_handler

            task_handler.schedule_on_action_update(self.wf_ex)
Exemplo n.º 3
0
def on_action_update(action_ex, state):
    task_ex = action_ex.task_execution

    action = _build_action(action_ex)

    try:
        action.update(state)
    except exc.MistralException as e:
        # If the update of the action execution fails, do not fail
        # the action execution. Log the exception and re-raise the
        # exception.
        msg = ("Failed to update action [error=%s, action=%s, task=%s]:\n%s" %
               (e, action_ex.name, task_ex.name, tb.format_exc()))

        LOG.error(msg)

        raise

    if task_ex:
        task_handler.schedule_on_action_update(action_ex)
Exemplo n.º 4
0
    def pause(self, msg=None):
        """Pause workflow.

        :param msg: Additional explaining message.
        """

        assert self.wf_ex

        if states.is_paused(self.wf_ex.state):
            return

        # Set the state of this workflow to paused.
        self.set_state(states.PAUSED, state_info=msg)

        # If workflow execution is a subworkflow,
        # schedule update to the task execution.
        if self.wf_ex.task_execution_id:
            # Import the task_handler module here to avoid circular reference.
            from mistral.engine import task_handler
            task_handler.schedule_on_action_update(self.wf_ex)
Exemplo n.º 5
0
def on_action_update(action_ex, state):
    task_ex = action_ex.task_execution

    action = _build_action(action_ex)

    try:
        action.update(state)
    except exc.MistralException as e:
        # If the update of the action execution fails, do not fail
        # the action execution. Log the exception and re-raise the
        # exception.
        msg = (
            "Failed to update action [error=%s, action=%s, task=%s]:\n%s"
            % (e, action_ex.name, task_ex.name, tb.format_exc())
        )

        LOG.error(msg)

        raise

    if task_ex:
        task_handler.schedule_on_action_update(action_ex)
Exemplo n.º 6
0
    def pause(self, msg=None):
        """Pause workflow.

        :param msg: Additional explaining message.
        """

        assert self.wf_ex

        if states.is_paused(self.wf_ex.state):
            return

        # Set the state of this workflow to paused.
        self.set_state(states.PAUSED, state_info=msg)

        # Publish event.
        self.notify(events.WORKFLOW_PAUSED)

        # If workflow execution is a subworkflow,
        # schedule update to the task execution.
        if self.wf_ex.task_execution_id:
            # Import the task_handler module here to avoid circular reference.
            from mistral.engine import task_handler
            task_handler.schedule_on_action_update(self.wf_ex)