nirs4all.pipeline.dagml.rt module
Runtime envelopes for the dag-ml backend — RtResult / RtRunRequest / RtError (B-018 / L10).
These are the thin, pure-projection wrappers the runtime API (LOCK-RT, DEC-RT-001) puts over
surfaces that ALREADY exist on the dag-ml backend — they add zero new dag-ml fields and never
recompute a score. The four inputs all live next to this module in pipeline/dagml/:
the native results triple (
manifest.json+score_set.json+predictions.parquet) written / read bynirs4all.pipeline.dagml.native_results;the raw native ScoreSet stashed on a dag-ml
RunResult(RunResult._dagml_score_set,nirs4all.pipeline.dagml.result._scores_to_run_result());the dag-ml error taxonomy (
DagMlUnsupported/DagMlUnavailable) therun()fallback catches.
Anchored on the dag-ml ScoreSet (score_set.schema.json): RtResult.reports is the VERBATIM
score_set.reports[] — the partition / level / fold_id / variant_id / target join key both the
Studio ChainSummary pivot and the Web RunResult nest are deterministic group-bys of. The wire
schema lives in nirs4all-ecosystem/docs/contracts/runtime/*.v1.schema.json (it $ref``s the dag-ml
contracts; the cause vocabulary is owned by ``CAP-004). This module is the Python projection; nothing
here mutates RunResult, the .n4a bundle, or the native results format (all 0.9.x-stable).
- class nirs4all.pipeline.dagml.rt.RtResult(schema_version: int, run_id: str | None, plan_id: str | None, selection: dict[str, ~typing.Any] | None, reports: list[dict[str, ~typing.Any]], predictions: list[dict[str, ~typing.Any]], manifest: dict[str, ~typing.Any], artifacts: list[dict[str, ~typing.Any]] | None = None, diagnostics: list[~nirs4all.pipeline.dagml.rt.RtError] = <factory>)[source]
Bases:
objectThe unified runtime result envelope (RT-002) — a pure projection of the dag-ml native triple.
Anchored on the dag-ml ScoreSet:
reportsis VERBATIMscore_set.reports[]. The StudioChainSummary(pivotgroup_by(run_id, variant)) and the WebRunResult(nestgroup_by(kind)) are both deterministic VIEWS of this envelope — neither is the contract. Constructed byfrom_native_dir()(wrappingread_native_results()) orfrom_run_result()(readingRunResult._dagml_score_set+ projecting the in-memory predictions); both are pure projections with no recompute.manifestmirrors the nativemanifest.jsonheader;diagnosticscarries anyRtError(e.g. “ran legacy because <cause>”).- classmethod from_native_dir(run_dir: str | Path, *, diagnostics: list[RtError] | None = None) RtResult[source]
Project a native results directory (
manifest+score_set+predictions) into an RtResult.Wraps
read_native_results()(which hash-validates the ScoreSet and verify-then-loads any model artifacts), then projects —reportsare the verbatim ScoreSet reports,predictionsare the round-tripped blocks,manifestmirrors the native header,artifactsare the recorded ArtifactRefs. No recompute.
- classmethod from_run_result(result: RunResult) RtResult[source]
Project a
RunResultinto an RtResult (pure; works for both engines).For a dag-ml result the ScoreSet is read from
result._dagml_score_set(reportsverbatim,engine="dag-ml"). For a LEGACY result (no native ScoreSet — e.g. the transparent fallback) the envelope is sparse (reports=[],enginefromper_dataset) but still carries the predictions projection and any attachedRtErrordiagnostics, so a caller always sees a uniform “ran <engine> because <cause>” envelope. No recompute — scores come from the ScoreSet rows.
- class nirs4all.pipeline.dagml.rt.RtRunRequest(pipeline_dsl: Any, dataset_ref: Any, cv: dict[str, ~typing.Any]=<factory>, execution_backend: str = 'local-python', options: dict[str, ~typing.Any]=<factory>)[source]
Bases:
objectThe unified runtime run request envelope (RT-002) — the
runverb’s input shape.{ pipeline_dsl, dataset_ref, cv, execution_backend, options }— the union of therun_via_dagmlfield set, theExecutionDriverCapabilityexecution_backendtaxonomy (local-python | wasm-local | cluster), and the NET-NEWoptions.allow_fallbackstrict-mode flag. A thin descriptor the Studio/Web runtimes fill and serialize; nirs4all’srun()still executes the pipeline (V1 does not re-route execution through this envelope).execution_backend(the environment) stays orthogonal to the MLengine(which rides inoptions).