Object Store Utilities¶
Rush stores some of the data used in runs in its own object store. This API exposes Rush object-store references and helper functions for uploading, fetching, and saving objects. It also includes TRC-specific helpers for working with TRC data in the object store, which are sometimes returned by Rush modules.
Identifiers¶
- rush.objects.ObjectID = rush.objects.ObjectID¶
UUID identifying an object in the Rush object store.
Object References¶
- class rush.objects.RushObject(path, size, format)[source]¶
Reference to an object in the Rush object store.
- Parameters:
path (ObjectID)
size (int)
format (Literal['Json', 'Bin'])
- classmethod from_dict(d)[source]¶
Construct from a raw GraphQL output dict.
Requires
path,size, andformatkeys.- Parameters:
d (dict[str, Any])
- Return type:
Self
- fetch(extract=False)[source]¶
Download this object into memory.
- Parameters:
extract (bool)
- Return type:
list[Any] | dict[str, Any] | bytes
- fetch_bytes(extract=False)[source]¶
Download this binary object into memory.
- Parameters:
extract (bool)
- Return type:
bytes
- fetch_dict()[source]¶
Download this JSON object and require a dictionary payload.
- Return type:
dict[str, Any]
- fetch_json()[source]¶
Download this JSON object into memory.
- Return type:
list[Any] | dict[str, Any]
- save(filepath=None, name=None, ext=None, extract=False)[source]¶
Download this object and save to the workspace.
The file type is derived from
formatautomatically. Pass ext to override the file extension (e.g."hdf5","a3m").- Parameters:
filepath (Path | str | None)
name (str | None)
ext (str | None)
extract (bool)
- Return type:
Path
- format: Literal['Json', 'Bin']¶
Storage format.
- size: int¶
Size in bytes.
TRC Object Support¶
- class rush.objects.TRCRef(topology, residues, chains)[source]¶
Reference to a single TRC triplet in the Rush object store.
- Parameters:
topology (RushObject)
residues (RushObject)
chains (RushObject)
- chains: RushObject¶
- residues: RushObject¶
- topology: RushObject¶
Object Store Functions¶
- rush.objects.upload_object(input)[source]¶
Upload an object at the filepath to the current project. Usually not necessary; the module functions should handle this automatically.
- Parameters:
input (Path | str | dict[str, Any])
- Return type:
dict[str, Any]
- rush.objects.fetch_object(path, extract=False)[source]¶
Fetch the contents of the given Rush object store path directly into memory.
Be careful: if the contents are too large, they might not fit into memory.
- Parameters:
path (str) – The Rush object store path to fetch.
extract (bool) – Automatically extract tar.zst archives in memory before returning.
- Returns:
the data from the object store path, as a dict (JSON objects) or bytes (bin objects)
- Return type:
list[Any] | dict[str, Any] | bytes
- rush.objects.save_object(path, filepath=None, name=None, type=None, ext=None, extract=False)[source]¶
Save a Rush object store path to the workspace.
Prefer
RushObject.save()when you have aRushObject. This function infers the format from the type parameter.- Parameters:
path (str)
filepath (Path | str | None)
name (str | None)
type (Literal['json', 'bin'] | None)
ext (str | None)
extract (bool)
- Return type:
Path