proxystore.connectors.endpoint¶
Endpoint connector implementation.
EndpointKey
¶
Bases: NamedTuple
Key to object in an Endpoint.
Attributes:
-
object_id
(str
) –Unique object ID.
-
endpoint_id
(str | None
) –Endpoint UUID where object is stored.
EndpointConnector
¶
Connector to ProxyStore Endpoints.
Warning
Specifying a custom proxystore_dir
can cause problems if the
proxystore_dir
is not the same on all systems that a proxy
created by this store could end up on. It is recommended to leave
the proxystore_dir
unspecified so the correct default directory
will be used.
Parameters:
-
endpoints
(Sequence[str | UUID]
) –Sequence of valid and running endpoint UUIDs to use. At least one of these endpoints must be accessible by this process.
-
proxystore_dir
(str | None
, default:None
) –Optionally specify the proxystore home directory. Defaults to
home_dir()
.
Raises:
-
ValueError
–If endpoints is an empty list.
-
EndpointConnectorError
–If unable to connect to one of the endpoints provided.
Source code in proxystore/connectors/endpoint.py
close
¶
config
¶
Get the connector configuration.
The configuration contains all the information needed to reconstruct the connector object.
Source code in proxystore/connectors/endpoint.py
from_config
classmethod
¶
from_config(config: dict[str, Any]) -> EndpointConnector
Create a new connector instance from a configuration.
Parameters:
Source code in proxystore/connectors/endpoint.py
evict
¶
evict(key: EndpointKey) -> None
Evict the object associated with the key.
Parameters:
-
key
(EndpointKey
) –Key associated with object to evict.
Source code in proxystore/connectors/endpoint.py
exists
¶
exists(key: EndpointKey) -> bool
Check if an object associated with the key exists.
Parameters:
-
key
(EndpointKey
) –Key potentially associated with stored object.
Returns:
-
bool
–If an object associated with the key exists.
Source code in proxystore/connectors/endpoint.py
get
¶
get(key: EndpointKey) -> bytes | None
Get the serialized object associated with the key.
Parameters:
-
key
(EndpointKey
) –Key associated with the object to retrieve.
Returns:
-
bytes | None
–Serialized object or
None
if the object does not exist.
Source code in proxystore/connectors/endpoint.py
get_batch
¶
get_batch(
keys: Sequence[EndpointKey],
) -> list[bytes | None]
Get a batch of serialized objects associated with the keys.
Parameters:
-
keys
(Sequence[EndpointKey]
) –Sequence of keys associated with objects to retrieve.
Returns:
-
list[bytes | None]
–List with same order as
keys
with the serialized objects orNone
if the corresponding key does not have an associated object.
Source code in proxystore/connectors/endpoint.py
new_key
¶
new_key(obj: bytes | None = None) -> EndpointKey
Create a new key.
Warning
The returned key will be associated with this instance's local
endpoint. I.e., when
set()
is called on this key, the connector must be connected to the same
local endpoint.
Parameters:
-
obj
(bytes | None
, default:None
) –Optional object which the key will be associated with. Ignored in this implementation.
Returns:
-
EndpointKey
–Key which can be used to retrieve an object once
set()
has been called on the key.
Source code in proxystore/connectors/endpoint.py
put
¶
put(obj: bytes) -> EndpointKey
Put a serialized object in the store.
Parameters:
-
obj
(bytes
) –Serialized object to put in the store.
Returns:
-
EndpointKey
–Key which can be used to retrieve the object.
Source code in proxystore/connectors/endpoint.py
put_batch
¶
put_batch(objs: Sequence[bytes]) -> list[EndpointKey]
Put a batch of serialized objects in the store.
Parameters:
Returns:
-
list[EndpointKey]
–List of keys with the same order as
objs
which can be used to retrieve the objects.
Source code in proxystore/connectors/endpoint.py
set
¶
set(key: EndpointKey, obj: bytes) -> None
Set the object associated with a key.
Note
The Connector
provides write-once, read-many semantics. Thus,
set()
should only be called once per key, otherwise unexpected behavior
can occur.
Parameters:
-
key
(EndpointKey
) –Key that the object will be associated with.
-
obj
(bytes
) –Object to associate with the key.