proxystore.store.factory¶
Factory implementations.
StoreFactory
¶
StoreFactory(
key: ConnectorKeyT,
store_config: StoreConfig,
*,
evict: bool = False,
)
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.
Calls to the factory from threads while another call (or
resolve_async())
is resolving the object wait for that result, so the object is resolved
once and every thread gets the same object.
Parameters:
-
key(ConnectorKeyT) –Key corresponding to object in store.
-
store_config(StoreConfig) –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.
Source code in proxystore/store/factory.py
get_store
¶
get_store() -> Store[ConnectorT]
Get store and reinitialize if necessary.
Raises:
-
StoreClosedError–If the owner of the store closed it and removed its objects in this process.
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.
-
StoreClosedError–If the owner of the store closed it and removed its objects in this process.
Source code in proxystore/store/factory.py
resolve_async
¶
Asynchronously get object associated with key from store.
Nothing happens if the object is already being resolved.
Source code in proxystore/store/factory.py
PollingStoreFactory
¶
PollingStoreFactory(
key: ConnectorKeyT,
store_config: StoreConfig,
*,
evict: bool = False,
polling: PollingPolicy | None = None,
)
Bases: StoreFactory[ConnectorT, T]
Factory that polls a store until an 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.
If the object is an exception, it is raised instead of returned.
Parameters:
-
key(ConnectorKeyT) –Key corresponding to object in store.
-
store_config(StoreConfig) –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. -
polling(PollingPolicy | None, default:None) –Policy for polling the store for the object. If
None, the defaultPollingPolicyis used.
Source code in proxystore/store/factory.py
resolve
¶
Get object associated with key from store.
Raises:
-
ProxyResolveMissingKeyError–If the object associated with the key is not available after the timeout of the polling policy.
-
Exception–The exception set on the future associated with this factory.
Source code in proxystore/store/factory.py
get_store
¶
get_store() -> Store[ConnectorT]
Get store and reinitialize if necessary.
Raises:
-
StoreClosedError–If the owner of the store closed it and removed its objects in this process.
Source code in proxystore/store/factory.py
resolve_async
¶
Asynchronously get object associated with key from store.
Nothing happens if the object is already being resolved.