class ExecutionStoreRepo(ABC): (source)
Known subclasses: fiftyone.factory.repos.execution_store.InMemoryExecutionStoreRepo
, fiftyone.factory.repos.execution_store.MongoExecutionStoreRepo
Constructor: ExecutionStoreRepo(dataset_id, is_cache)
Abstract base class for execution store repositories.
Each instance operates in a context:
- If a dataset_id
is provided, it operates on stores associated with that dataset.
- If no dataset_id
is provided, it operates on stores not associated with any dataset.
To operate on all stores across all contexts, use the XXX_global() methods that this class provides.
Method | __init__ |
Initialize the execution store repository. |
Method | cleanup |
Delete all stores in the global store collection. |
Method | clear |
Clear all keys with either a ttl or policy="eviction". |
Method | count |
Count the number of keys in a store. |
Method | count |
Count the number of stores in the store collection. |
Method | count |
Count the number of stores in the global store collection. |
Method | create |
Create a store in the store collection. |
Method | delete |
Delete a key from a store. |
Method | delete |
Delete a store. |
Method | delete |
Delete a store from the global store collection. |
Method | get |
Get a key from a store. |
Method | get |
Get a store from the store collection. |
Method | has |
Check if a key exists in a store. |
Method | has |
Check if a store exists in the store collection. |
Method | has |
Check if a store exists in the global store collection. |
Method | list |
List all keys in a store. |
Method | list |
List all stores in the store collection. |
Method | list |
List all stores in the global store collection. |
Method | set |
Set a cache key in a store. |
Method | set |
Set a key in a store. |
Method | update |
Update the TTL of a key. |
Instance Variable | _dataset |
Undocumented |
fiftyone.factory.repos.execution_store.InMemoryExecutionStoreRepo
, fiftyone.factory.repos.execution_store.MongoExecutionStoreRepo
Delete all stores in the global store collection.
Returns | |
int | the number of documents deleted |
fiftyone.factory.repos.execution_store.InMemoryExecutionStoreRepo
, fiftyone.factory.repos.execution_store.MongoExecutionStoreRepo
Clear all keys with either a ttl or policy="eviction".
Parameters | |
storestr , optional | the name of the store to clear. If None, all stores will be queried for deletion. |
fiftyone.factory.repos.execution_store.InMemoryExecutionStoreRepo
, fiftyone.factory.repos.execution_store.MongoExecutionStoreRepo
Count the number of stores in the store collection.
Returns | |
int | the number of stores |
fiftyone.factory.repos.execution_store.InMemoryExecutionStoreRepo
, fiftyone.factory.repos.execution_store.MongoExecutionStoreRepo
Count the number of stores in the global store collection.
Returns | |
int | the number of stores |
def create_store(self, store_name:
str
, metadata: dict[ str, Any] | None
= None, policy: str
= 'persist') -> StoreDocument
:
(source)
¶
fiftyone.factory.repos.execution_store.InMemoryExecutionStoreRepo
, fiftyone.factory.repos.execution_store.MongoExecutionStoreRepo
Get a key from a store.
Parameters | |
storestr | the name of the store to get the key from |
key:str | the key to get |
Returns | |
Optional[KeyDocument] | the key document, or None if the key does not exist |
fiftyone.factory.repos.execution_store.InMemoryExecutionStoreRepo
, fiftyone.factory.repos.execution_store.MongoExecutionStoreRepo
Get a store from the store collection.
Parameters | |
storestr | the name of the store to get |
Returns | |
Optional[StoreDocument] | the store document, or None if the store does not exist |
fiftyone.factory.repos.execution_store.InMemoryExecutionStoreRepo
, fiftyone.factory.repos.execution_store.MongoExecutionStoreRepo
List all stores in the global store collection.
Returns | |
List[StoreDocument] | a list of store documents |
def set_cache_key(self, store_name:
str
, key: str
, value: Any
, ttl: int | None
= None) -> KeyDocument
:
(source)
¶
def set_key(self, store_name:
str
, key: str
, value: Any
, ttl: int | None
= None, policy: str
= 'persist') -> KeyDocument
:
(source)
¶
fiftyone.factory.repos.execution_store.InMemoryExecutionStoreRepo
, fiftyone.factory.repos.execution_store.MongoExecutionStoreRepo
Set a key in a store.
Parameters | |
storestr | The name of the store to set the key in. |
key:str | The key to set. |
value:Any | The value to associate with the key. |
ttl:Optional[int] | Optional TTL (in seconds) after which the key will expire and be automatically removed. |
policy:str | The eviction policy for the key. One of: - "persist" (default): Key is persistent until deleted. - "evict": Key is eligible for eviction or cache clearing. |
Returns | |
KeyDocument | The created or updated key document. |