Record batch runs beside cascades so Home lists them

A batch run opens no cascade, and FlowRun was written only from
cascade_started — so `fluksio run` showed on /runs and in `fluksio status` and
was simply absent from Home. The collector now folds the run_started and
run_finished events RunService already published. Such a record is exempt from
the staleness sweep in both places: a training step of an hour is a normal one,
and only run_finished ends it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-27 15:54:15 +02:00
co-authored by Claude Opus 5
parent 6bc71ddaf3
commit 121cb2e8f0
3 changed files with 89 additions and 12 deletions
+9 -4
View File
@@ -279,14 +279,19 @@ class EngineEvent(SQLModel, table=True):
class FlowRun(SQLModel, table=True):
"""One cascade, from the item that started it to the last node in it."""
"""One cascade, from the item that started it to the last node in it.
Or one batch run: it opens no cascade, but it is still a thing that ran,
and the history screens are where somebody looks for it.
"""
__tablename__ = "flow_run"
#: The queue entry id, or a `manual-` one for a run that never queued.
#: The queue entry id, a `manual-` one for a run that never queued, or the
#: `Run.id` of a batch run.
id: str = Field(primary_key=True, max_length=64)
flow: str = Field(index=True, max_length=255)
#: What caused it: the work item's cause, or "manual".
#: What caused it: the work item's cause, "manual", or "run" for a batch.
source: str = ""
started_at: datetime = Field(
index=True,
@@ -296,7 +301,7 @@ class FlowRun(SQLModel, table=True):
default=None,
sa_type=UTCDateTime,
)
#: running, ok, error or abandoned.
#: running, ok, error, abandoned — or whatever a batch run ended as.
status: str = "running"
nodes: int = 0
errors: int = 0