A batch flow's input is a run parameter, not a missing value

This commit is contained in:
2026-08-25 18:51:54 +02:00
parent 4cdcf19de1
commit f9de811d9c
4 changed files with 35 additions and 5 deletions
+21
View File
@@ -1,9 +1,11 @@
"""The wiring fundamentals: name binding, fan-in, namespaces, validation."""
from fluksio.flow.controller import _declared_inputs
from fluksio.flow.events import EventBus
from fluksio.flow.messages import DType, MessageSpec
from fluksio.flow.nodes import Node
from fluksio.flow.pipeline import Pipeline
from fluksio.flow.schemas import FlowDef, FlowInput
def spec(name: str, dtype: DType = DType.FLOAT, port: str = "") -> MessageSpec:
@@ -131,6 +133,25 @@ def test_a_flow_input_without_a_starting_value_is_reported():
assert [issue.code for issue in issues] == ["missing_initial_value"]
def test_a_batch_flows_input_is_a_run_parameter_not_a_missing_value():
"""A flow that only runs when asked gets its inputs from the run.
Calling that a message nothing ever sets had the health summary count a
training flow as one that cannot run while the Runs screen showed it
running. A live flow, which nothing is going to start on its own, still
reports it.
"""
node = make_node(
"n", "f", lambda setpoint, params: None, requires=[spec("setpoint")]
)
batch = FlowDef(name="f", mode="batch", inputs=[FlowInput(spec=spec("setpoint"))])
live = batch.model_copy(update={"mode": "live"})
assert Pipeline(nodes=[node]).validate(_declared_inputs(batch)[0]) == []
issues = Pipeline(nodes=[node]).validate(_declared_inputs(live)[0])
assert [issue.code for issue in issues] == ["missing_initial_value"]
def test_a_failing_node_does_not_stop_its_siblings():
ran = []