nirs4all.pipeline.dagml.progress module

Invocation-scoped observation of real DAG operator execution.

Observers receive only bounded execution metadata, never spectra or targets. Progress measures completed cross-validation fits, not elapsed fit time. The unit is one FIT_CV task of one model node on one fold of one pipeline variant, so a dispatch owes variants x folds x model nodes fits. Tuning trials run inside a model fit and are not counted.

A sequence of model checkpoints runs as one dispatch per model. The caller announces the dispatch count with ExecutionProgress.plan_dispatches(); without that announcement only the first dispatch has a trustworthy denominator. Bookkeeping failures degrade the percentage to “unknown” and never reach the scientific code.

class nirs4all.pipeline.dagml.progress.ExecutionProgress(callback: 'Callable[[dict[str, Any]], None]', dataset: 'str' = '', total_variants: 'int' = 1, completed: 'set[tuple[Any, ...]]' = <factory>, variants: 'dict[tuple[Any, ...], int]' = <factory>, total_folds: 'int' = 0, model_nodes: 'int' = 0, bundle: 'int' = 0, planned_dispatches: 'int' = 0, dispatches: 'int' = 0, skipped_dispatches: 'int' = 0, settled_dispatches: 'int' = 0, settled_fits: 'int' = 0, settled_total: 'int' = 0, peak: 'float' = 0.0, reliable_total: 'bool' = True, lock: 'RLock' = <factory>)[source]

Bases: object

bundle: int = 0
callback: Callable[[dict[str, Any]], None]
completed: set[tuple[Any, ...]]
configure(variants: int, dataset: str) → None[source]
dataset: str = ''
property dispatch_total: int

CV fits owed by the current dispatch (0 until its first bundle is opened).

dispatches: int = 0
emit(message: str, **fields: Any) → None[source]
lock: RLock
model_nodes: int = 0
open_bundle(dsl: dict[str, Any], graph: dict[str, Any]) → tuple[int, dict[str, int]][source]
peak: float = 0.0
plan_dispatches(count: int) → None[source]

Announce the single-model dispatches the invocation is about to run.

An announcement made while an earlier one is still being consumed is a nested expansion of work already counted, so it is ignored.

planned_dispatches: int = 0
reliable_total: bool = True
settled_dispatches: int = 0
settled_fits: int = 0
settled_total: int = 0
skipped_dispatches: int = 0
task(bundle: int, folds: dict[str, int], task: dict[str, Any], node: dict[str, Any], *, completed: bool) → None[source]
property total_fits: int

CV fits owed by the whole invocation; announced dispatches not yet sized are assumed average.

total_folds: int = 0
total_variants: int = 1
variants: dict[tuple[Any, ...], int]
nirs4all.pipeline.dagml.progress.execution_progress() → ExecutionProgress | None[source]

Return the current invocation observer, if explicitly installed.

nirs4all.pipeline.dagml.progress.observe_progress(callback: Callable[[dict[str, Any]], None]) → Iterator[ExecutionProgress][source]

Observe the actual synchronous execution without changing scientific inputs.