A batch run fails a node with no value on a triggering input instead of calling it, naming the input and its producer, and skips what waits on it
This commit is contained in:
@@ -1486,6 +1486,17 @@ class Pipeline:
|
||||
complete(n)
|
||||
continue
|
||||
ready_inputs: dict[str, Any] | None = None
|
||||
if failed is not None:
|
||||
# A live wave's readiness rule: a node runs once every
|
||||
# triggering input has a value. A run has nothing to wait
|
||||
# for, so the node fails instead.
|
||||
ready_inputs = state.get_present(list(n.requires))
|
||||
missing = self._no_value(n, ready_inputs)
|
||||
if missing:
|
||||
failed.add(n)
|
||||
self._observe(NodeOutcome(node=n.id, ok=False, error=missing))
|
||||
complete(n)
|
||||
continue
|
||||
if check_ready:
|
||||
ready, ready_inputs = self._is_node_ready(n, state, entry_id)
|
||||
if not ready:
|
||||
@@ -1530,6 +1541,18 @@ class Pipeline:
|
||||
|
||||
return state
|
||||
|
||||
def _no_value(self, node: Node, values: dict[str, Any]) -> str:
|
||||
"""The first triggering input with nothing in ``values``, as an error,
|
||||
or "" when there is none."""
|
||||
for name, spec in node.requires.items():
|
||||
if spec.trigger and name not in values:
|
||||
producers = ", ".join(
|
||||
f"'{p.local_id}'" for p in self.produces.get(name, ())
|
||||
)
|
||||
where = f" from {producers}" if producers else ""
|
||||
return f"No value on input '{spec.port or name}'{where}"
|
||||
return ""
|
||||
|
||||
def run(
|
||||
self, inputs: dict[str, Any] | None = None, nodes: set[Node] | None = None
|
||||
) -> StateBackend:
|
||||
|
||||
Reference in New Issue
Block a user