Use constants for the execution event strings
Since these will be used in the future, add a comment saying this, as well as switch to using executor level constants instead of local strings for these events. Change-Id: I0bd6e1ca09da0dbae0d0c2787ceb9ce1a41cb7de
This commit is contained in:
@@ -26,6 +26,10 @@ from taskflow.utils import async_utils
|
||||
from taskflow.utils import misc
|
||||
from taskflow.utils import threading_utils
|
||||
|
||||
# Revert or execution events...
|
||||
EXECUTED = 'executed'
|
||||
REVERTED = 'reverted'
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def _autobind(task, bind_name, bind_func, **kwargs):
|
||||
@@ -48,7 +52,7 @@ def _execute_task(task, arguments, progress_callback):
|
||||
# NOTE(imelnikov): wrap current exception with Failure
|
||||
# object and return it
|
||||
result = misc.Failure()
|
||||
return task, 'executed', result
|
||||
return (task, EXECUTED, result)
|
||||
|
||||
|
||||
def _revert_task(task, arguments, result, failures, progress_callback):
|
||||
@@ -62,7 +66,7 @@ def _revert_task(task, arguments, result, failures, progress_callback):
|
||||
# NOTE(imelnikov): wrap current exception with Failure
|
||||
# object and return it
|
||||
result = misc.Failure()
|
||||
return task, 'reverted', result
|
||||
return (task, REVERTED, result)
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
|
||||
@@ -82,6 +82,8 @@ class FutureGraphAction(object):
|
||||
not_done = list(not_done)
|
||||
next_nodes = []
|
||||
for future in done:
|
||||
# NOTE(harlowja): event will be used in the future for smart
|
||||
# reversion (ignoring it for now).
|
||||
node, _event, result = future.result()
|
||||
complete_node(node, result)
|
||||
if isinstance(result, misc.Failure):
|
||||
|
||||
Reference in New Issue
Block a user