Skip to content

proxystore.store.exceptions

Exceptions for Stores.

StoreError

Bases: Exception

Base exception class for store errors.

StoreClosedError

StoreClosedError(store_id: str)

Bases: StoreError

Exception raised when using a store that was closed and cleared.

When the owner of a store is closed and its connector removes the stored objects, the ID of the store stays closed for the rest of the process. Resolving proxies of the store in that process raises this error instead of making a new store.

Init StoreClosedError.

Parameters:

  • store_id (str) –

    ID of the closed store.

Source code in proxystore/store/exceptions.py
def __init__(self, store_id: str) -> None:
    """Init StoreClosedError.

    Args:
        store_id: ID of the closed store.
    """
    self.store_id = store_id
    super().__init__(
        f'The store with id={store_id!r} was closed by its owner in this '
        'process, which also removed the objects of the store. Proxies '
        'of the store cannot be resolved in this process.',
    )

ProxyStoreFactoryError

Bases: StoreError

Exception raised when a proxy was not created by a Store.

ProxyResolveMissingKeyError

ProxyResolveMissingKeyError(
    key: ConnectorKeyT,
    store_type: type[Store[Any]],
    store_name: str | None,
    store_id: str | None = None,
)

Bases: StoreError

Exception raised when the key associated with a proxy is missing.

Init ProxyResolveMissingKeyError.

Parameters:

  • key (ConnectorKeyT) –

    Key associated with target object that could not be found in the store.

  • store_type (type[Store[Any]]) –

    Type of store that the key could not be found in.

  • store_name (str | None) –

    Name of store that the key could not be found in.

  • store_id (str | None, default: None ) –

    ID of store that the key could not be found in.

Source code in proxystore/store/exceptions.py
def __init__(
    self,
    key: base.ConnectorKeyT,
    store_type: type[base.Store[Any]],
    store_name: str | None,
    store_id: str | None = None,
) -> None:
    """Init ProxyResolveMissingKeyError.

    Args:
        key: Key associated with target object that could not be found in
            the store.
        store_type: Type of store that the key could not be found in.
        store_name: Name of store that the key could not be found in.
        store_id: ID of store that the key could not be found in.
    """
    self.key = key
    self.store_type = store_type
    self.store_name = store_name
    self.store_id = store_id
    store = ', '.join(
        f'{attr}={value!r}'
        for attr, value in (('id', store_id), ('name', store_name))
        if value is not None
    )
    super().__init__(
        f"Cannot resolve target object with key='{self.key}' "
        f'from {self.store_type.__name__}({store}) '
        'because there is no object associated with the key. This can '
        'often occur when the target object is evicted from the store '
        'while proxies of the target still exist.',
    )

NonProxiableTypeError

Bases: StoreError

Exception raised when proxying an unproxiable type.