Relabel internal engine 'event' -> 'outcome'

Instead of calling the variable name 'event' it is
more appropriate to call these variable names 'outcome' (or
'outcomes') since they represent the 'outcome' (EXECUTED,
or REVERTED) of a atom and are not event types.

To avoid the confusion just relabel these to be outcome(s)
instead.

Change-Id: Ia9caebe279145e4887491151d40a4f59650d40d4
This commit is contained in:
Joshua Harlow
2015-08-22 08:28:59 -07:00
committed by Joshua Harlow
parent 79d25e69e8
commit 6f6e9a3b2c
3 changed files with 13 additions and 13 deletions

View File

@@ -196,8 +196,8 @@ class MachineBuilder(object):
fut = memory.done.pop()
atom = fut.atom
try:
event, result = fut.result()
retain = do_complete(atom, event, result)
outcome, result = fut.result()
retain = do_complete(atom, outcome, result)
if isinstance(result, failure.Failure):
if retain:
memory.failures.append(result)
@@ -211,10 +211,10 @@ class MachineBuilder(object):
intention = self._storage.get_atom_intention(
atom.name)
LOG.debug("Discarding failure '%s' (in"
" response to event '%s') under"
" response to outcome '%s') under"
" completion units request during"
" completion of atom '%s' (intention"
" is to %s)", result, event,
" is to %s)", result, outcome,
atom, intention)
except Exception:
memory.failures.append(failure.Failure())

View File

@@ -113,16 +113,16 @@ class Completer(object):
self._retry_action = runtime.retry_action
self._undefined_resolver = RevertAll(self._runtime)
def _complete_task(self, task, event, result):
def _complete_task(self, task, outcome, result):
"""Completes the given task, processes task failure."""
if event == ex.EXECUTED:
if outcome == ex.EXECUTED:
self._task_action.complete_execution(task, result)
else:
self._task_action.complete_reversion(task, result)
def _complete_retry(self, retry, event, result):
def _complete_retry(self, retry, outcome, result):
"""Completes the given retry, processes retry failure."""
if event == ex.EXECUTED:
if outcome == ex.EXECUTED:
self._retry_action.complete_execution(retry, result)
else:
self._retry_action.complete_reversion(retry, result)
@@ -149,18 +149,18 @@ class Completer(object):
unfinished_atoms.add(atom)
return unfinished_atoms
def complete(self, node, event, result):
def complete(self, node, outcome, result):
"""Performs post-execution completion of a node.
Returns whether the result should be saved into an accumulator of
failures or whether this should not be done.
"""
if isinstance(node, task_atom.BaseTask):
self._complete_task(node, event, result)
self._complete_task(node, outcome, result)
else:
self._complete_retry(node, event, result)
self._complete_retry(node, outcome, result)
if isinstance(result, failure.Failure):
if event == ex.EXECUTED:
if outcome == ex.EXECUTED:
self._process_atom_failure(node, result)
else:
# Reverting failed, always retain the failure...

View File

@@ -35,7 +35,7 @@ from taskflow.types import failure
from taskflow.types import notifier
from taskflow.utils import threading_utils
# Execution and reversion events.
# Execution and reversion outcomes.
EXECUTED = 'executed'
REVERTED = 'reverted'