proxystore.endpoint.files¶
Helpers for files in endpoint directories.
VersionedFile
¶
Bases: BaseModel
Base model of a file in an endpoint directory.
Each file written by ProxyStore has a format version which is incremented
on incompatible changes to the file format. Subclasses set the default of
version to the version supported by this version of ProxyStore, and a
file with any other version is rejected.
Example
Attributes:
-
DESCRIPTION(str) –Description of the file for error messages.
-
version(int) –Format version of the file.
write_private_file
¶
Atomically write data to a file that only the owner can access.
The data is written to a temporary file with mode 0600 in the same
directory which then replaces path, so readers never observe a
partially written file.
Source code in proxystore/endpoint/files.py
read_model
¶
Read a file written by an endpoint.
The file is parsed as TOML if path ends with .toml and as JSON
otherwise.
Raises:
-
FileNotFoundError–If the file does not exist.
-
EndpointConfigError–If the file is malformed or has an unsupported format version.
Source code in proxystore/endpoint/files.py
write_model
¶
write_model(path: str, instance: VersionedFile) -> None
Atomically write a file only the owner can access.
The file is written as TOML if path ends with .toml and as JSON
otherwise. See
write_private_file().