Fix xstatus when graph is empty.

This commit is contained in:
Romain Dorgueil
2018-07-28 13:34:09 +01:00
parent b30dbaec22
commit 71fce07f99
2 changed files with 4 additions and 5 deletions

View File

@ -149,10 +149,10 @@ class GraphExecutionContext(BaseContext):
for plugin_context in self.plugins: for plugin_context in self.plugins:
plugin_context.unregister() plugin_context.unregister()
@property @property
def xstatus(self): def xstatus(self):
""" """
UNIX-like exit status, only coherent if the context has stopped. UNIX-like exit status, only coherent if the context has stopped.
""" """
return max(node.xstatus for node in self.nodes) return max(node.xstatus for node in self.nodes) if len(self.nodes) else 0

View File

@ -302,9 +302,8 @@ class NodeExecutionContext(BaseContext, WithStatistics):
input_bag = self._input_type(*input_bag) input_bag = self._input_type(*input_bag)
except Exception as exc: except Exception as exc:
raise UnrecoverableTypeError( raise UnrecoverableTypeError(
'Input type changed to incompatible type between calls to {!r}.\nGot {!r} which is not of type {!r}.'.format( 'Input type changed to incompatible type between calls to {!r}.\nGot {!r} which is not of type {!r}.'.
self.wrapped, input_bag, self._input_type format(self.wrapped, input_bag, self._input_type)
)
) from exc ) from exc
# Store or check input length, which is a soft fallback in case we're just using tuples # Store or check input length, which is a soft fallback in case we're just using tuples