nirs4all.pipeline.dagml.resources module

Run-local DAG-ML execution resource declarations.

The value is stored in a contextvars.ContextVar so concurrent runs do not communicate through process-global environment variables. Both the in-process binding and the subprocess CLI read the same normalized contract.

class nirs4all.pipeline.dagml.resources.DagMLExecutionResources(cpu_threads: int = 1, gpu_devices: tuple[str, ...] = ())[source]

Bases: object

Resources declared for every host task in one DAG-ML run.

cpu_threads: int = 1
gpu_devices: tuple[str, ...] = ()
to_contract() → dict[str, Any][source]

Return the closed DAG-ML TrainingResourceLimits payload.

nirs4all.pipeline.dagml.resources.bind_execution_resources(resources: DagMLExecutionResources) → Token[source]

Bind resources to the current run context and return its reset token.

nirs4all.pipeline.dagml.resources.normalize_execution_resources(cpu_threads: Any = 1, gpu_devices: Any = ()) → DagMLExecutionResources[source]

Validate and canonicalize public DAG-ML resource options.

nirs4all.pipeline.dagml.resources.reset_execution_resources(token: Token) → None[source]

Restore the prior run-local resource declaration.