MemoryCheckpointStore¶
Bases: BaseCheckpointStore
An in-memory twin of CheckpointStore, holding values by reference.
It keeps the first value stored for a key and attribute. consolidate
and write_snapshot do nothing.
Attributes¶
| Name | Type | Value | Doc |
|---|---|---|---|
layout(inherited) |
StoreLayout |
unset |
Merge every payload into the canonical file.
The value of attr at key; KeyError if absent everywhere.
iter_items ¶
iter_items(attr: str | None = None, *, keys: Iterable[int] | None = None, strict: bool = True) -> Iterator[tuple[int, Any]]
Yield (key, value) pairs, each key once, in ascending order.
The durable store keeps the current file open between yields, so finish or close the iterator before writing to the same store.
The sorted keys stored for attr.
missing¶
Inherited method from BaseCheckpointStore.missing().
nested ¶
nested(key: int, attr: str = '_program_results', layout: StoreLayout = SHOT_LAYOUT) -> BaseCheckpointStore
A read-only view of the object stored at key in attr.
put_batch ¶
put_batch(entries: Mapping[int, Mapping[str, Any]], *, worker_id: str | None = None, encode_cache: dict | None = None) -> BatchReceipt
Store a batch of entries and return a receipt.
write_snapshot ¶
write_snapshot(obj: Serializable, *, keep_entries: bool = False, encode_cache: dict | None = None) -> None
Atomically write the canonical file from obj.
With keep_entries, the committed entries of the existing file
replace obj's own streamed entries. encode_cache receives the
new file's seed (see CheckpointStore.write_snapshot).