nemo_rl.data_plane.prefix_writer_actor#
Prefix-only TQ writes in an isolated, serial CPU Ray actor.
Cut transactions and encoding stay in the generation worker. Owned numeric columns cross the actor boundary, and a caller receives its keys only after TQ acknowledges the write. Terminal writes use their original local client.
Module Contents#
Classes#
Execute one PUT or failed-write cleanup at a time in the writer actor. |
|
Own the process-local TQ client, with no engine or GPU allocation. |
|
The sink’s prefix client, forwarding each call to the writer actor. |
Functions#
Expose a CPU column as raw bytes, plus its dtype, shape and jagged offsets. |
|
Rebuild a column from |
|
Create one non-restarting, serial CPU writer on the generation node. |
Data#
API#
- nemo_rl.data_plane.prefix_writer_actor.G_LOGGER#
‘getLogger(…)’
- nemo_rl.data_plane.prefix_writer_actor._WRITER_STARTUP_TIMEOUT_S#
180
- nemo_rl.data_plane.prefix_writer_actor.to_bytes(
- tensor: torch.Tensor,
Expose a CPU column as raw bytes, plus its dtype, shape and jagged offsets.
Ray pickles a tensor by copying its data; NumPy arrays travel as separate buffers the actor reads from shared memory without a copy.
- nemo_rl.data_plane.prefix_writer_actor.from_bytes(
- data: numpy.ndarray,
- dtype: str,
- shape: tuple[int, ...],
- offsets: numpy.ndarray | None,
Rebuild a column from
to_bytesas a view of Ray’s buffer.
- class nemo_rl.data_plane.prefix_writer_actor.PrefixWriterService(client: Any)#
Execute one PUT or failed-write cleanup at a time in the writer actor.
Initialization
- put_samples(
- *,
- sample_ids: list[str],
- partition_id: str,
- columns: dict[str, tuple[Any, ...]],
- tags: list[dict[str, Any]],
Write one batch; returns once TQ acknowledges it.
- clear_samples(*, sample_ids: list[str], partition_id: str) None#
- get_data_plane_snapshot() dict[str, Any] | None#
- class nemo_rl.data_plane.prefix_writer_actor.PrefixWriterActor( )#
Bases:
nemo_rl.data_plane.prefix_writer_actor.PrefixWriterServiceOwn the process-local TQ client, with no engine or GPU allocation.
Initialization
- ready() dict[str, Any]#
- exception nemo_rl.data_plane.prefix_writer_actor.PrefixWriterDiedError#
Bases:
RuntimeErrorThe writer actor is gone; it is never restarted.
Initialization
Initialize self. See help(type(self)) for accurate signature.
- class nemo_rl.data_plane.prefix_writer_actor.RayPrefixWriterClient(actor: Any, *, writer_pid: int)#
The sink’s prefix client, forwarding each call to the writer actor.
The actor options run one call at a time with no retries, and killing the actor fails its pending call, so nothing is acknowledged early. Close is teardown-only. Once the actor dies, every later call raises
PrefixWriterDiedErrorrather than falling back to another client.Initialization
- _require_open() None#
- _get(reference: Any) Any#
Resolve one actor call, marking the writer dead if the actor is gone.
- put_samples(
- *,
- sample_ids: list[str],
- partition_id: str,
- fields: tensordict.TensorDict,
- tags: list[dict[str, Any]],
- clear_samples(*, sample_ids: list[str], partition_id: str) None#
- async get_data_plane_snapshot() dict[str, Any] | None#
The writer client’s data-plane counters.
Nonewhen observability is off or the writer is closed or dead; the cuts report a dead writer. Waits behind an in-flight PUT, since the actor runs one call at a time.
- close() None#
- async nemo_rl.data_plane.prefix_writer_actor.create_prefix_writer( ) nemo_rl.data_plane.prefix_writer_actor.RayPrefixWriterClient#
Create one non-restarting, serial CPU writer on the generation node.