Refactoring workflow handler
* Introduced new class Workflow that manages life-cycle of running workflows and is responsible for managing workflow persistent state * Moved all workflow level logic to workflow handler and Workflow class * Changed semantics if how workflows start errors are handled. Previously, in case of invalid user input Mistral engine would store information about error in "state_info" field of workflow execution and bubble up an exception to the user. This approach was incorrect for a number of reasons including broken semantics: if an exception was raised due to invalid input it's normal to expect that system state has not changed. After this refactoring, engine only raises an exception in case of bad user input. That way behavior is consistent with the idea of exceptional situations. * Fixed unit tests in according to the previous point * Fixed a number of logical issues in tests. For example, in test_default_engine.py we expected one type of errors (e.g. env not found) but effectively received another one (invalid input). Partially implements: blueprint mistral-engine-error-handling Change-Id: I09070411fd833df8284cb80db69b8401a40eb6fe
This commit is contained in:
@@ -111,6 +111,8 @@ class WorkflowController(object):
|
||||
if self._is_paused_or_completed():
|
||||
return []
|
||||
|
||||
# TODO(rakhmerov): I think it should rather be a new method
|
||||
# rerun_task() because it covers a different use case.
|
||||
if task_ex:
|
||||
return self._get_rerun_commands([task_ex], reset, env=env)
|
||||
|
||||
@@ -199,7 +201,11 @@ class WorkflowController(object):
|
||||
:param env: A set of environment variables to overwrite.
|
||||
:return: List of workflow commands.
|
||||
"""
|
||||
|
||||
for task_ex in task_exs:
|
||||
# TODO(rakhmerov): It is wrong that we update something in
|
||||
# workflow controller, by design it should not change system
|
||||
# state. Fix it, it should happen outside.
|
||||
self._update_task_ex_env(task_ex, env)
|
||||
|
||||
cmds = [commands.RunExistingTask(t_e, reset) for t_e in task_exs]
|
||||
|
||||
Reference in New Issue
Block a user