improv.store
#
Module Contents#
Classes#
General interface for a store |
|
Basic interface for our specific data store implemented with apache arrow plasma |
|
General interface for a store |
|
Dataclass to store objects and their metadata into LMDB. |
Attributes#
General interface for a store |
- improv.store.logger#
- class improv.store.PlasmaStoreInterface(name='default', store_loc='/tmp/store')[source]#
Bases:
StoreInterface
Basic interface for our specific data store implemented with apache arrow plasma Objects are stored with object_ids References to objects are contained in a dict where key is shortname, value is object_id
- connect_store(store_loc)[source]#
Connect to the store at store_loc, max 20 retries to connect Raises exception if can’t connect Returns the plasmaclient if successful Updates the client internal
- Parameters:
store_loc – store location
- put(object, object_name)[source]#
Put a single object referenced by its string name into the store Raises PlasmaObjectExists if we are overwriting Unknown error
- Parameters:
object –
object_name (str) –
flush_this_immediately (bool) –
- Returns:
Plasma object ID
- Return type:
class ‘plasma.ObjectID’
- Raises:
PlasmaObjectExists – if we are overwriting unknown error
- get(object_name)[source]#
Get a single object from the store by object name Checks to see if it knows the object first Otherwise throw CannotGetObject to request dict update TODO: update for lists of objects TODO: replace with getID
- Returns:
Stored object
- getID(obj_id, hdd_only=False)[source]#
Get object by object ID
- Parameters:
obj_id (class 'plasma.ObjectID') – the id of the object
hdd_only (bool) –
- Returns:
Stored object
- Raises:
ObjectNotFoundError – If the id is not found
- getList(ids)[source]#
Get multiple objects from the store
- Parameters:
ids (list) – of type plasma.ObjectID
- Returns:
list of the objects
- get_all()[source]#
Get a listing of all objects in the store
- Returns:
list of all the objects in the store
- subscribe()[source]#
Subscribe to a section? of the ds for singals
- Raises:
Exception – Unknown error
- class improv.store.LMDBStoreInterface(path='../outputs/', name=None, load=False, max_size=1000000000000.0, flush_immediately=False, commit_freq=1)[source]#
Bases:
StoreInterface
General interface for a store
- get(key: pyarrow.plasma.ObjectID | bytes | List[pyarrow.plasma.ObjectID] | List[bytes], include_metadata=False)[source]#
Get object using key (could be any byte string or plasma.ObjectID)
- Parameters:
key –
include_metadata (bool) – returns whole LMDBData if true else LMDBData.obj (just the stored object).
- Returns:
object or LMDBData
- put(obj, obj_name, obj_id=None, flush_this_immediately=False)[source]#
Put object ID / object pair into LMDB.
- Parameters:
obj – Object to be saved
obj_name (str) – the name of the object
obj_id ('plasma.ObjectID') – Object_id from Plasma client
flush_this_immediately (bool) – Override self.flush_immediately. For storage of critical objects.
- Returns:
None
- delete(obj_id)[source]#
Delete object from LMDB.
- Parameters:
obj_id (class 'plasma.ObjectID') – the object_id to be deleted
- Returns:
None
- Raises:
ObjectNotFoundError – If the id is not found
- class improv.store.LMDBData[source]#
Dataclass to store objects and their metadata into LMDB.
- property queue#
Returns: Queue name if object is a queue else None
- obj: object#
- time: float#
- name: str#
- is_queue: bool = False#
- exception improv.store.ObjectNotFoundError(obj_id_or_name)[source]#
Bases:
Exception
Common base class for all non-exit exceptions.