Show the failure discarded (and the future intention)

When DEBUG is enabled it is quite useful to show information
about why a failure of a atom is being discarded (typically
it is being retried) so when this happens and DEBUG is enabled
add appropriate logging messages that show this decision and
future intentions.

Change-Id: I9aeb928ce85d057f872392b593b3e97f694474d1
This commit is contained in:
Joshua Harlow
2015-01-22 14:46:47 -08:00
parent d65721fb5a
commit 93d73b85c6

View File

@@ -143,8 +143,24 @@ class _MachineBuilder(object):
try:
event, result = fut.result()
retain = self._completer.complete(node, event, result)
if retain and isinstance(result, failure.Failure):
memory.failures.append(result)
if isinstance(result, failure.Failure):
if retain:
memory.failures.append(result)
else:
# NOTE(harlowja): avoid making any
# intention request to storage unless we are
# sure we are in DEBUG enabled logging (otherwise
# we will call this all the time even when DEBUG
# is not enabled, which would suck...)
if LOG.isEnabledFor(logging.DEBUG):
intention = self._storage.get_atom_intention(
node.name)
LOG.debug("Discarding failure '%s' (in"
" response to event '%s') under"
" completion units request during"
" completion of node '%s' (intention"
" is to %s)", result, event,
node, intention)
except Exception:
memory.failures.append(failure.Failure())
else: