fluksio.arrived(): a node can tell which inputs the wave behind it wrote, so a value written again unchanged is seen

This commit is contained in:
2026-11-05 21:24:21 +01:00
parent b7f1d21712
commit 7ddf8aa8f9
9 changed files with 127 additions and 7 deletions
+24 -3
View File
@@ -44,6 +44,7 @@ from fluksio.flow.namespace import (
VERSION,
)
from fluksio.flow.nodes import Node
from fluksio.flow.nodes.base import ARRIVED
from fluksio.flow.queue import WorkQueue
from fluksio.flow.state import MemoryState, StateBackend
@@ -1070,6 +1071,7 @@ class Pipeline:
entry_id: str = "",
overrides: dict[str, Any] | None = None,
inputs: dict[str, Any] | None = None,
arrived: list[str] | None = None,
) -> dict[str, Any] | None:
"""Run one node and record its outputs. Never raises.
@@ -1108,8 +1110,12 @@ class Pipeline:
if hit:
return restored
with logs.capture(collected):
result = node.execute(inputs)
token = ARRIVED.set(arrived)
try:
with logs.capture(collected):
result = node.execute(inputs)
finally:
ARRIVED.reset(token)
self.publish_log(node, collected, "")
if (
@@ -1483,8 +1489,23 @@ class Pipeline:
if replay and entry_id and self._already_done(entry_id, n):
complete(n)
continue
# Which of its inputs this wave wrote, so a node can tell a
# value written again from one that only sits in state.
arrived = (
sorted(
spec.port for name, spec in n.requires.items() if name in fresh
)
if fresh is not None
else None
)
future = executor.submit(
self._execute_node, n, state, entry_id, overrides, ready_inputs
self._execute_node,
n,
state,
entry_id,
overrides,
ready_inputs,
arrived,
)
node_futures[future] = n
future.add_done_callback(finished.put)