diff --git a/taskflow/engines/action_engine/executor.py b/taskflow/engines/action_engine/executor.py index b2bdbdae..40a671eb 100644 --- a/taskflow/engines/action_engine/executor.py +++ b/taskflow/engines/action_engine/executor.py @@ -19,6 +19,7 @@ import abc from concurrent import futures import six +from taskflow import task as _task from taskflow.utils import async_utils from taskflow.utils import misc from taskflow.utils import threading_utils @@ -44,8 +45,8 @@ def _execute_task(task, arguments, progress_callback): def _revert_task(task, arguments, result, failures, progress_callback): kwargs = arguments.copy() - kwargs['result'] = result - kwargs['flow_failures'] = failures + kwargs[_task.REVERT_RESULT] = result + kwargs[_task.REVERT_FLOW_FAILURES] = failures with task.autobind('update_progress', progress_callback): try: task.pre_revert() diff --git a/taskflow/task.py b/taskflow/task.py index cd470e72..211f09cc 100644 --- a/taskflow/task.py +++ b/taskflow/task.py @@ -27,6 +27,14 @@ from taskflow.utils import reflection LOG = logging.getLogger(__name__) +# Constants passed into revert kwargs. +# +# Contain the execute() result (if any). +REVERT_RESULT = 'result' +# +# The cause of the flow failure/s +REVERT_FLOW_FAILURES = 'flow_failures' + @six.add_metaclass(abc.ABCMeta) class BaseTask(atom.Atom):