nirs4all.pipeline.dagml.methods_replay module

Native Methods N4MM replay callbacks for a loaded DAG-ML package.

This module is deliberately narrow. It is the Python host adapter for an already-validated, portable n4m_model artifact: DAG-ML owns package, identity, replay scheduling and output validation; pls4all owns N4MM import and numerical prediction. It neither decodes model bytes nor reimplements PLS.

The callback pair matches dag_ml.replay_loaded_predictor_package’s op_callback / artifact_callback contracts. It supports a target-free PREDICT task only. FIT/CV/REFIT, host sidecars, transforms and unknown artifact kinds are intentionally refused rather than routed through legacy PipelineRunner.

class nirs4all.pipeline.dagml.methods_replay.MethodsN4mmReplayCallbacks(resolver: FeatureMaterializationResolver, *, target_names_by_node: dict[str, list[str]], fallback: Callable[[dict[str, Any]], dict[str, Any]] | None = None, context_type: type[Any] | None = None, model_type: type[Any] | None = None)[source]

Bases: object

Own invocation-local N4MM handles for a Methods-only PREDICT replay.

fallback is used only for non-model graph nodes (the normal DAG-ML passthrough data nodes). A model without one exact hydrated N4MM handle is always refused. context_type and model_type are injectable solely for host-contract tests; production resolves them from the official pls4all binding lazily.

property active_handle_count: int

Number of invocation-local N4MM imports currently retained.

artifact_callback(event: dict[str, Any]) → dict[str, Any] | None[source]

Hydrate/release one raw N4MM payload on behalf of DAG-ML.

close() → None[source]

Release every remaining invocation-local import, idempotently.

op_callback(task: dict[str, Any]) → dict[str, Any][source]

Run one target-free PREDICT task using its exact N4MM handle.

exception nirs4all.pipeline.dagml.methods_replay.MethodsPortableReplayError[source]

Bases: RuntimeError

A portable Methods replay cannot be executed by this host adapter.