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, and format keys.

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]

fetch_list()[source]

Download this JSON object and require a list payload.

Return type:

list[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 format automatically. 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

to_dict()[source]
Return type:

dict[str, Any]

format: Literal['Json', 'Bin']

Storage format.

path: ObjectID

UUID path in the object store.

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:
classmethod upload(trc)[source]
Parameters:

trc (TRC)

Return type:

Self

fetch()[source]

Download and parse into a TRC.

Return type:

TRC

save()[source]

Download and save to the workspace.

Return type:

TRCPaths

chains: RushObject
residues: RushObject
topology: RushObject
class rush.objects.TRCPaths(topology, residues, chains)[source]

Workspace paths for a saved TRC triplet.

Parameters:
  • topology (Path)

  • residues (Path)

  • chains (Path)

chains: Path
residues: Path
topology: Path

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 a RushObject. 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

rush.objects.save_json(d, filepath=None, name=None)[source]

Save a JSON file into the workspace folder. Convenient for saving non-object JSON output from a module run alongside the object outputs.

Parameters:
  • d (dict[str, Any])

  • filepath (Path | str | None)

  • name (str | None)

Return type:

Path