proxystore.serialize¶
Serialization functions.
serialize() ¶
Serialize object.
Objects are serialized using pickle (protocol 4) except for bytes or str objects. If pickle fails, cloudpickle is used as a fallback.
Parameters:
-
obj
(Any
) –Object to serialize.
Returns:
-
bytes
–Bytes that can be passed to
deserialize()
.
Source code in proxystore/serialize.py
deserialize() ¶
Deserialize object.
Parameters:
-
data
(bytes
) –Bytes produced by
serialize()
.
Returns:
-
Any
–The deserialized object.
Raises:
-
ValueError
–If
data
is not of typebytes
. -
SerializationError
–If the identifier of
data
is missing or invalid. The identifier is prepended to the string inserialize()
to indicate which serialization method was used (e.g., no serialization, pickle, etc.).