kairos.commands.run¶
kairos.commands.run ¶
kairos run weekly and kairos run validation: pipeline orchestrators.
The pipeline runs six stages in a fixed order::
refresh -> fit -> dials -> governor -> ledger -> export
Each stage lives in another package (data, models, dials, governor, ledger,
dashboard). The orchestrator does not import them at module load time.
Instead every stage lists one or more entry points (module:function)
that are tried in order. The first one that imports wins. If none can be
imported the stage is reported as unavailable and the pipeline carries
on, so the command works on a partial checkout and picks stages up as they
land.
A stage entry point has the signature (ctx: RunContext) -> Mapping | None.
What it returns is stored in ctx.artifacts[stage_name] so later stages
can read it.
StageStatus ¶
Bases: StrEnum
Outcome of a single stage.
Stage
dataclass
¶
One pipeline stage and the entry points that may implement it.
RunContext
dataclass
¶
State shared by every stage of one run.
StageResult
dataclass
¶
What happened to one stage.
RunReport
dataclass
¶
pipelines ¶
pipelines() -> dict[str, tuple[Stage, ...]]
Return the named pipelines, looked up at call time.
resolve_entry_point ¶
resolve_entry_point(spec: str) -> StageFn | None
Import module:attr and return it, or None if it is missing.
Only a missing module or attribute counts as "unavailable". An import that fails for another reason (a bug in the stage) is re-raised so it is reported as a failure rather than hidden.
run_pipeline ¶
run_pipeline(
ctx: RunContext,
stages: Sequence[Stage] = WEEKLY_STAGES,
*,
only: Sequence[str] = (),
skip: Sequence[str] = (),
keep_going: bool = False,
) -> RunReport
Run stages in order and return a report.
A failed stage stops the run (later stages are skipped) unless
keep_going is set. Unavailable stages never stop the run.
main ¶
main(argv: Sequence[str] | None = None) -> int
Entry point. Exit codes: 0 ok, 1 a stage failed, 2 strict and a stage unavailable.