proxystore.store.factory¶
Factory implementations.
StoreFactory ¶
StoreFactory(
key: ConnectorKeyT,
store_config: dict[str, Any],
*,
evict: bool = False,
deserializer: DeserializerT | None = None
)
Bases: Generic[ConnectorT, T]
Factory that resolves an object from a store.
Adds support for asynchronously retrieving objects from a
Store
instance.
The factory takes the store_config
parameter that is
used to reinitialize the store if the factory is sent to a remote
process where the store has not already been initialized.
Parameters:
-
key
(ConnectorKeyT
) –Key corresponding to object in store.
-
store_config
(dict[str, Any]
) –Store configuration used to reinitialize the store if needed.
-
evict
(bool
, default:False
) –If True, evict the object from the store once
resolve()
is called. -
deserializer
(DeserializerT | None
, default:None
) –Optional callable used to deserialize the byte string. If
None
, the default deserializer (deserialize()
) will be used.
Source code in proxystore/store/factory.py
get_store() ¶
Get store and reinitialize if necessary.
Raises:
-
ValueError
–If the type of the returned store does not match the expected store type passed to the factory constructor.
Source code in proxystore/store/factory.py
resolve() ¶
Get object associated with key from store.
Raises:
-
ProxyResolveMissingKeyError
–If the key associated with this factory does not exist in the store.
Source code in proxystore/store/factory.py
resolve_async() ¶
Asynchronously get object associated with key from store.
PollingStoreFactory ¶
PollingStoreFactory(
key: ConnectorKeyT,
store_config: dict[str, Any],
*,
deserializer: DeserializerT | None = None,
evict: bool = False,
polling_interval: float = 1,
polling_timeout: float | None = None
)
Bases: StoreFactory[ConnectorT, T]
Factory that polls a store until and object can be resolved.
This is an extension of the
StoreFactory
with the
resolve()
method
overridden to poll the store until the target object is available.
Parameters:
-
key
(ConnectorKeyT
) –Key corresponding to object in store.
-
store_config
(dict[str, Any]
) –Store configuration used to reinitialize the store if needed.
-
deserializer
(DeserializerT | None
, default:None
) –Optional callable used to deserialize the byte string. If
None
, the default deserializer (deserialize()
) will be used. -
evict
(bool
, default:False
) –If True, evict the object from the store once
resolve()
is called. -
polling_interval
(float
, default:1
) –Seconds to sleep between polling the store for the object.
-
polling_timeout
(float | None
, default:None
) –Optional maximum number of seconds to poll for.
Source code in proxystore/store/factory.py
get_store() ¶
Get store and reinitialize if necessary.
Raises:
-
ValueError
–If the type of the returned store does not match the expected store type passed to the factory constructor.
Source code in proxystore/store/factory.py
resolve_async() ¶
Asynchronously get object associated with key from store.
resolve() ¶
Get object associated with key from store.
Raises:
-
ProxyResolveMissingKeyError
–If the object associated with the key is not available after
polling_timeout
seconds.