nemo_rl.data_plane.adapters.tq_simple_checkpoint#

NeMo-RL’s two-phase compatibility layer for TQ 0.1.11 SimpleStorage.

Only storage dictionaries are copied during capture, not their tensor payloads. The audited StorageUnitData API replaces/removes values; it never modifies a stored value in place or exposes it to another in-process caller. Strong references therefore preserve the cut across subsequent PUT/CLEAR operations. The shared lock excludes the actor’s ZMQ mutation thread while copying indexes.

Persistence runs on the Ray actor thread, concurrently with the ZMQ worker, and writes TQ’s ordinary checkpoint layout. No tensor payload travels via Ray. SSD/hybrid storage is deliberately unsupported. Re-audit this contract when updating TQ; this module must not silently run against another implementation.

Module Contents#

Classes#

SnapshotStorageMixin

Added before the pinned storage actor base; ZMQ and Ray share one lock.

SimpleCheckpointCapture

Own one captured view on each shard until publication or abort.

Functions#

_wait_all

Observe every RPC within one budget; timeout never cancels remote work.

configure_simple_checkpoint

Patch bootstrap before tq.init; do not modify an already running actor.

capture_simple_checkpoint

Detach controller and retain shards while the mutation cut is held.

Data#

API#

nemo_rl.data_plane.adapters.tq_simple_checkpoint.LOGGER#

‘getLogger(…)’

nemo_rl.data_plane.adapters.tq_simple_checkpoint._wait_all(
refs: list[Any],
*,
timeout_s: float | None = None,
raise_errors: bool = True,
) → list[Any]#

Observe every RPC within one budget; timeout never cancels remote work.

class nemo_rl.data_plane.adapters.tq_simple_checkpoint.SnapshotStorageMixin(*args: Any, **kwargs: Any)#

Added before the pinned storage actor base; ZMQ and Ray share one lock.

Initialization

_handle_put(data_parts: Any) → Any#
_handle_clear(data_parts: Any) → Any#
_handle_load_checkpoint(data_parts: Any) → Any#
nrl_capture_snapshot(token: str) → str#

Capture on this actor; return only its native storage ID.

nrl_persist_snapshot(token: str, path: str) → int#

Serialize retained values, without locking live PUT/CLEAR traffic.

nrl_release_snapshot(token: str) → None#

Idempotent; ordered behind persistence RPCs on this Ray actor.

nemo_rl.data_plane.adapters.tq_simple_checkpoint.configure_simple_checkpoint() → None#

Patch bootstrap before tq.init; do not modify an already running actor.

class nemo_rl.data_plane.adapters.tq_simple_checkpoint.SimpleCheckpointCapture#

Bases: nemo_rl.data_plane.checkpoint.CheckpointCapture

Own one captured view on each shard until publication or abort.

checkpoint_dir: pathlib.Path#

None

token: str#

None

controller: Any#

None

units: list[Any]#

None

storage_info: list[dict[str, Any]]#

None

metadata: dict[str, Any]#

None

timeout_s: float#

None

_persist_started: bool#

‘field(…)’

_released: bool#

‘field(…)’

_persist_refs: list[Any]#

‘field(…)’

_operation_lock: threading.Lock#

‘field(…)’

_operation() → collections.abc.Iterator[float]#
persist(
*,
extra_metadata: collections.abc.Mapping[str, Any] | None = None,
) → None#
release() → None#
nemo_rl.data_plane.adapters.tq_simple_checkpoint.capture_simple_checkpoint(
checkpoint_dir: str | pathlib.Path,
*,
num_storage_units: int,
metadata: dict[str, Any] | None,
timeout_s: float,
) → nemo_rl.data_plane.adapters.tq_simple_checkpoint.SimpleCheckpointCapture#

Detach controller and retain shards while the mutation cut is held.

The native manager’s ID order, not Ray actor lookup order, determines shard positions. Native restore maps those positions to its newly allocated IDs.