Simplify workflow and join completion logic

* action_queue module is replaced with the more generic
  post_tx_queue module that allows to register operations that must
  run after the main DB transaction associated with processing a
  workflow event such as completing action.
* Instead of calling workflow completion check from all places
  where task may possibly complete, Mistral now registers a post
  transactional operation that runs after the main DB transaction
  (to make sure at least one needed consistent DB read) right
  inside the task completion logic. It reduces clutter significantly.
* Workflow completion check is now registered only if the just
  completed task may lead to workflow completion, i.e. if it's the
  last one in a workflow branch.
* Join now checks delayed calls to reduce a number of join
  completion checks created with scheduler and also uses post
  transactional queue for that.

Closes-Bug: #1801872
Change-Id: I90741d4121c48c42606dfa850cfe824557b095d0
This commit is contained in:
Renat Akhmerov
2018-10-26 17:13:52 +07:00
parent 3d7acd3957
commit 80a1bed67b
16 changed files with 338 additions and 286 deletions

View File

@@ -229,6 +229,11 @@ class WorkflowController(object):
"""
raise NotImplementedError
def may_complete_workflow(self, task_ex):
"""Determines if the task execution may lead to workflow completion."""
return states.is_completed(task_ex.state)
@abc.abstractmethod
def _find_next_commands(self, task_ex):
"""Finds commands that should run next.