nemo_rl.models.generation.prefix_recovery.write_pipeline#
Bounded prefix preparation overlapped with one durable write stream.
Module Contents#
Classes#
Bounds of the write pipeline every generation-prefix cut goes through. |
|
Immutable rows; only their owner thread may resume their transactions. |
|
All transactions of the preceding write have sealed or rolled back. |
|
Keep lifecycle ownership on one thread while a separate thread writes. |
Functions#
Estimated encoded size of one cut row, for the write pipeline’s byte bounds. |
Data#
API#
- nemo_rl.models.generation.prefix_recovery.write_pipeline.LOGGER#
‘getLogger(…)’
- class nemo_rl.models.generation.prefix_recovery.write_pipeline.PrefixWriteLimits#
Bounds of the write pipeline every generation-prefix cut goes through.
- max_pending_inventories: int#
None
- max_buffered_payload_bytes: int#
None
- max_batch_payload_bytes: int#
None
- coalesce_wait_seconds: float#
None
- __post_init__() None#
- nemo_rl.models.generation.prefix_recovery.write_pipeline.PREFIX_WRITE_LIMITS#
‘PrefixWriteLimits(…)’
- nemo_rl.models.generation.prefix_recovery.write_pipeline._TOKEN_BYTES#
None
- nemo_rl.models.generation.prefix_recovery.write_pipeline._ROW_BYTES#
512
- nemo_rl.models.generation.prefix_recovery.write_pipeline.estimate_prefix_row_bytes(
- record: Any,
- attachments: collections.abc.Mapping[str, Any] | None,
Estimated encoded size of one cut row, for the write pipeline’s byte bounds.
- class nemo_rl.models.generation.prefix_recovery.write_pipeline.PrefixWrite#
Immutable rows; only their owner thread may resume their transactions.
- checkpoint_id: str#
None
- records: tuple[Any, ...]#
None
- sequences: tuple[int, ...]#
None
- attachments: tuple[Any, ...]#
None
- payload_bytes: int#
None
- fallback: collections.abc.Callable[[BaseException], list[str | None]]#
None
- property tokens: int#
- class nemo_rl.models.generation.prefix_recovery.write_pipeline.WriteSettled#
All transactions of the preceding write have sealed or rolled back.
- nemo_rl.models.generation.prefix_recovery.write_pipeline.CutWrites#
None
- class nemo_rl.models.generation.prefix_recovery.write_pipeline._Job#
- inventory: Any#
None
- deadline: float | None#
None
- future: concurrent.futures.Future[Any]#
None
- iterator: nemo_rl.models.generation.prefix_recovery.write_pipeline.CutWrites | None#
None
- request: nemo_rl.models.generation.prefix_recovery.write_pipeline.PrefixWrite | None#
None
- reservation: int#
0
- class nemo_rl.models.generation.prefix_recovery.write_pipeline.PrefixWritePipeline(
- *,
- limits: nemo_rl.models.generation.prefix_recovery.write_pipeline.PrefixWriteLimits,
- max_batch_rows: int,
- max_batch_tokens: int,
- sink: Any,
- prepare: collections.abc.Callable[..., nemo_rl.models.generation.prefix_recovery.write_pipeline.CutWrites],
Keep lifecycle ownership on one thread while a separate thread writes.
Inventories sharing a model call never prepare concurrently. Duplicate in-flight inventory requests share their result. Byte reservations cover prepared/in-flight numeric columns, plus one maximum preparation batch; they do not bound live generation histories or total process RSS.
Initialization
- submit(
- inventory: Any,
- *,
- deadline: float | None,
- counts() dict[str, int]#
Counts since this pipeline started.
- Returns:
write_batches, themerged_inventoriesthey carried,failed_inventoriesandpeak_buffered_payload_bytes.
- _reserve(
- job: nemo_rl.models.generation.prefix_recovery.write_pipeline._Job,
- amount: int,
- *,
- allow_overflow: bool = False,
- _finish(
- job: nemo_rl.models.generation.prefix_recovery.write_pipeline._Job,
- *,
- result: Any = None,
- error: BaseException | None = None,
- _advance( ) None#
- _write( ) list[list[str | None] | BaseException]#
- _collect() list[nemo_rl.models.generation.prefix_recovery.write_pipeline._Job]#
- _complete(
- jobs: list[nemo_rl.models.generation.prefix_recovery.write_pipeline._Job],
- future: concurrent.futures.Future[Any],
- _notify(future: concurrent.futures.Future[Any]) None#
- _run() None#
- close(*, wait: bool) None#
Reject new work; drain started writes before releasing transactions.