proxystore.store.factory¶
Factory implementations.
StoreFactory
¶
StoreFactory(
key: ConnectorKeyT,
store_config: StoreConfig,
*,
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
(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. -
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() -> Store[ConnectorT]
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: StoreConfig,
*,
deserializer: DeserializerT | None = None,
evict: bool = False,
polling_interval: float = 1,
polling_backoff_factor: float = 1,
polling_interval_limit: float | None = None,
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
(StoreConfig
) –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
) –Initial seconds to sleep between polling the store for the object.
-
polling_backoff_factor
(float
, default:1
) –Multiplicative factor applied to the polling_interval applied after each unsuccessful poll.
-
polling_interval_limit
(float | None
, default:None
) –Maximum polling interval allowed. Prevents the backoff factor from increasing the current polling interval to unreasonable values.
-
polling_timeout
(float | None
, default:None
) –Optional maximum number of seconds to poll for. If the timeout is reached an error is raised.
Source code in proxystore/store/factory.py
get_store
¶
get_store() -> Store[ConnectorT]
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.