class documentation

Service for managing execution store operations.

Note that each instance of this service has a context:

  • If a dataset_id is provided (or a repo associated with one), this instance operates on stores associated with that dataset
  • If no dataset_id is provided (or a repo is provided that is not associated with one), this instance operates on stores that are not associated with a dataset

To operate on all stores across all contexts, use the XXX_global() methods that this class provides.

Parameters
repoa fiftyone.factory.repos.execution_store.ExecutionStoreRepo If not provided, a new fiftyone.factory.repos.execution_store.MongoExecutionStoreRepo will be created
dataset_ida dataset ID to scope operations to
collection_namea collection name to use for the execution store. If repo is provided, this argument is ignored
Method __init__ Undocumented
Method cleanup Deletes all stores associated with the current context.
Method clear_cache Clears all cache entries in the execution stores.
Method count_keys Counts the keys in the specified store.
Method count_stores Counts the stores for the current context.
Method count_stores_global Counts the stores across all datasets and the global context.
Method create_store Creates a new store with the specified name.
Method delete_key Deletes the specified key from the store.
Method delete_store Deletes the specified store.
Method delete_store_global Deletes the specified store across all datasets and the global context.
Method get_key Retrieves the value of a key from the specified store.
Method get_store Gets the specified store for the current context.
Method has_key Determines whether the specified key exists in the specified store.
Method has_store Determines whether the specified store exists in the current context.
Method has_store_global Determines whether a store with the given name exists across all datasets and the global context.
Method list_keys Lists all keys in the specified store.
Method list_stores Lists all stores for the current context.
Method list_stores_global Lists the stores across all datasets and the global context.
Method set_cache_key Sets the value of a cache key in the specified store.
Method set_key Sets the value of a key in the specified store.
Method update_ttl Updates the TTL of the specified key in the store.
Instance Variable _dataset_id Undocumented
Instance Variable _repo Undocumented
def __init__(self, repo: ExecutionStoreRepo | None = None, dataset_id: ObjectId | None = None, collection_name: str = None): (source)

Undocumented

def cleanup(self): (source)

Deletes all stores associated with the current context.

def clear_cache(self, store_name=None): (source)

Clears all cache entries in the execution stores.

def count_keys(self, store_name: str) -> int: (source)

Counts the keys in the specified store.

Parameters
store_name:strthe name of the store
Returns
intthe number of keys in the store
def count_stores(self) -> int: (source)

Counts the stores for the current context.

Returns
intthe number of stores
def count_stores_global(self) -> int: (source)

Counts the stores across all datasets and the global context.

Returns
intthe number of stores
def create_store(self, store_name: str, metadata: dict[str, Any] | None = None, policy: str = 'persist') -> StoreDocument: (source)

Creates a new store with the specified name.

Parameters
store_name:strthe name of the store
metadata:dict[str, Any] | NoneUndocumented
policy:strUndocumented
Returns
StoreDocumenta fiftyone.store.models.StoreDocument
def delete_key(self, store_name: str, key: str) -> bool: (source)

Deletes the specified key from the store.

Parameters
store_name:strthe name of the store
key:strthe key to delete
Returns
boolTrue if the key was deleted, False otherwise
def delete_store(self, store_name: str) -> StoreDocument: (source)

Deletes the specified store.

Parameters
store_name:strthe name of the store
Returns
StoreDocumenta fiftyone.store.models.StoreDocument
def delete_store_global(self, store_name) -> int: (source)

Deletes the specified store across all datasets and the global context.

Parameters
store_namethe name of the store
Returns
intthe number of stores deleted
def get_key(self, store_name: str, key: str) -> KeyDocument: (source)

Retrieves the value of a key from the specified store.

Parameters
store_name:strthe name of the store
key:strthe key to retrieve
Returns
KeyDocumenta fiftyone.store.models.KeyDocument
def get_store(self, store_name: str) -> StoreDocument: (source)

Gets the specified store for the current context.

Parameters
store_name:strthe name of the store
Returns
StoreDocumenta fiftyone.store.models.StoreDocument
def has_key(self, store_name: str, key: str) -> bool: (source)

Determines whether the specified key exists in the specified store.

Parameters
store_name:strthe name of the store
key:strthe key to check
Returns
boolUndocumented
def has_store(self, store_name) -> bool: (source)

Determines whether the specified store exists in the current context.

Parameters
store_namethe name of the store
Returns
boolTrue/False
def has_store_global(self, store_name) -> bool: (source)

Determines whether a store with the given name exists across all datasets and the global context.

Parameters
store_namethe name of the store
Returns
boolTrue/False
def list_keys(self, store_name: str) -> list[str]: (source)

Lists all keys in the specified store.

Parameters
store_name:strthe name of the store
Returns
list[str]a list of keys in the store
def list_stores(self) -> list[str]: (source)

Lists all stores for the current context.

Returns
list[str]a list of store names
def list_stores_global(self) -> list[StoreDocument]: (source)

Lists the stores across all datasets and the global context.

Returns
list[StoreDocument]a list of fiftyone.store.models.StoreDocument
def set_cache_key(self, store_name: str, key: str, value: Any, ttl: int | None = None) -> KeyDocument: (source)

Sets the value of a cache key in the specified store.

Parameters
store_name:strthe name of the store
key:strthe key to set
value:Anythe value to set
ttl:Nonean optional TTL in seconds
Returns
KeyDocumentUndocumented
def set_key(self, store_name: str, key: str, value: Any, ttl: int | None = None, policy: str = 'persist') -> KeyDocument: (source)

Sets the value of a key in the specified store.

Keys can be either persistent or cacheable, depending on the provided policy or whether a TTL (time-to-live) is set.

  • If policy="persist" (default), the key will remain in the store until explicitly deleted.
  • If policy="evict", the key may be evicted by the system or manually removed using ~clear_cache.
  • If a TTL is provided, the key is always treated as policy="evict".
Parameters
store_name:strthe name of the store
key:strthe key to set
value:Anythe value to set
ttl:Nonean optional TTL in seconds
policy:persistthe eviction policy for the key. Can be "persist" or "evict". If "persist", the key will never be automatically removed. If "evict", the key may be removed automatically if a TTL is set, or manually via clear_cache.
Returns
KeyDocumentThe created or updated key document.
def update_ttl(self, store_name: str, key: str, new_ttl: int) -> KeyDocument: (source)

Updates the TTL of the specified key in the store.

Parameters
store_name:strthe name of the store
key:strthe key to update the TTL for
new_ttl:intthe new TTL in seconds
Returns
KeyDocumenta fiftyone.store.models.KeyDocument
_dataset_id = (source)

Undocumented

_repo: ExecutionStoreRepo = (source)

Undocumented