Пример #1
0
def need_to_continue(task_ex, task_spec):
    # For now continue is available only for with-items.
    if task_spec.get_with_items():
        return (with_items.has_more_iterations(task_ex)
                and with_items.get_concurrency(task_ex))

    return False
Пример #2
0
    def on_action_complete(self, action_ex):
        assert self.task_ex

        state = action_ex.state

        # TODO(rakhmerov): Here we can define more informative messages
        # cases when action is successful and when it's not. For example,
        # in state_info we can specify the cause action.
        # The use of action_ex.output.get('result') for state_info is not
        # accurate because there could be action executions that had
        # failed or was cancelled prior to this action execution.
        state_info = {
            states.SUCCESS: None,
            states.ERROR: 'One or more action executions had failed.',
            states.CANCELLED: 'One or more action executions was cancelled.'
        }

        with_items.increase_capacity(self.task_ex)

        if with_items.is_completed(self.task_ex):
            state = with_items.get_final_state(self.task_ex)
            self.complete(state, state_info[state])
            return

        if (with_items.has_more_iterations(self.task_ex)
                and with_items.get_concurrency(self.task_ex)):
            self._schedule_actions()
Пример #3
0
    def on_action_complete(self, action_ex):
        assert self.task_ex

        # TODO(rakhmerov): Here we can define more informative messages
        # cases when action is successful and when it's not. For example,
        # in state_info we can specify the cause action.
        # The use of action_ex.output.get('result') for state_info is not
        # accurate because there could be action executions that had
        # failed or was cancelled prior to this action execution.
        state_info = {
            states.SUCCESS: None,
            states.ERROR: 'One or more action executions had failed.',
            states.CANCELLED: 'One or more action executions was cancelled.'
        }

        with_items.increase_capacity(self.task_ex)

        if with_items.is_completed(self.task_ex):
            state = with_items.get_final_state(self.task_ex)

            self.complete(state, state_info[state])

            return

        if (with_items.has_more_iterations(self.task_ex)
                and with_items.get_concurrency(self.task_ex)):
            self._schedule_actions()
Пример #4
0
def need_to_continue(task_ex, task_spec):
    # For now continue is available only for with-items.
    if task_spec.get_with_items():
        return (with_items.has_more_iterations(task_ex)
                and with_items.get_concurrency(task_ex))

    return False
Пример #5
0
    def on_action_complete(self, action_ex):
        state = action_ex.state
        # TODO(rakhmerov): Here we can define more informative messages
        # cases when action is successful and when it's not. For example,
        # in state_info we can specify the cause action.
        state_info = (None if state == states.SUCCESS
                      else action_ex.output.get('result'))

        with_items.increase_capacity(self.task_ex)

        if with_items.is_completed(self.task_ex):
            self.complete(
                with_items.get_final_state(self.task_ex),
                state_info
            )

            return

        if (with_items.has_more_iterations(self.task_ex)
                and with_items.get_concurrency(self.task_ex)):
            self._schedule_actions()