rush.client

exception rush.client.RushRunError(message, trace='')[source]

Bases: Exception

Raised when a Rush run fails during collection.

Parameters:
  • message (str)

  • trace (str)

Return type:

None

message: str
trace: str = ''
class rush.client.ObjectID

UUID identifying an object in the Rush object store.

alias of str

class rush.client.RunOpts(name=None, description=None, tags=None, email=None)[source]

Bases: object

The description currently doesn’t show up anywhere. The tags will also show up in the Rush UI and will (eventually) allow for run searching and filtering. The email flag, if set to True, will cause an email to be sent to you upon run completion.

Parameters:
  • name (str | None)

  • description (str | None)

  • tags (list[str] | None)

  • email (bool | None)

description: str | None = None
email: bool | None = None
name: str | None = None

Shows up as the name (i.e. title) of the run in the Rush UI.

tags: list[str] | None = None
class rush.client.RunSpec(target=None, walltime=None, storage=10, storage_units='MB', cpus=None, gpus=None, nodes=None)[source]

Bases: object

The run specification: configuration for the target and resources of a run.

Parameters:
  • target (Target | None)

  • walltime (int | None)

  • storage (int | None)

  • storage_units (StorageUnit | None)

  • cpus (int | None)

  • gpus (int | None)

  • nodes (int | None)

cpus: int | None = None

The number of CPUs for the run. Default is module-specific.

gpus: int | None = None

The number of GPUs for the run. Default is module-specific.

nodes: int | None = None

The number of nodes for the run. Only relevant for supercomputer targets. Default is module-specific.

storage: int | None = 10

Max storage in the specified storage units for the run.

storage_units: StorageUnit | None = 'MB'

The storage units for the run.

target: Target | None = None

The Rush-specified hardware that the run will be submitted to. By default, randomly chooses a cloud compute “Bullet” node of the three available.

walltime: int | None = None

Max walltime in minutes for the run.

class rush.client.RushObject(path, size, format)[source]

Bases: object

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)

Return type:

RushObject

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.

class rush.client.RushRunInfo(id, created_at, updated_at, status, deleted_at=None, name=None, description=None, tags=None, result=None, stdout=None, trace=None, walltime=None, sus=None)[source]

Bases: object

Print it out to see a nicely-formatted summary of a run!

Parameters:
  • id (RunID)

  • created_at (str)

  • updated_at (str)

  • status (str)

  • deleted_at (str | None)

  • name (str | None)

  • description (str | None)

  • tags (list[str] | None)

  • result (dict | None)

  • stdout (str | None)

  • trace (dict | None)

  • walltime (int | float | None)

  • sus (dict[str, int | float] | None)

created_at: str
deleted_at: str | None = None
description: str | None = None
id: RunID
name: str | None = None
result: dict | None = None
status: str
stdout: str | None = None
sus: dict[str, int | float] | None = None
tags: list[str] | None = None
trace: dict | None = None
updated_at: str
walltime: int | float | None = None
rush.client.collect_run(run_id, max_wait_time=3600)[source]

Wait until the run finishes and return its outputs.

Raises:

RushRunError – If the run times out, is cancelled, or finishes with an error.

Parameters:
  • run_id (str | RunID)

  • max_wait_time (int)

rush.client.delete_run(run_id)[source]

Delete a run by ID.

Parameters:

run_id (str | RunID)

Return type:

None

rush.client.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.

rush.client.fetch_run_info(run_id)[source]

Fetch all info for a run by ID.

Returns None if the run doesn’t exist.

Parameters:

run_id (str | RunID)

Return type:

RushRunInfo | None

rush.client.fetch_runs(*, name=None, name_contains=None, status=None, tags=None, limit=None)[source]

Query runs and return their IDs.

Parameters:
  • name (str | None) – Filter by exact run name (case-insensitive).

  • name_contains (str | None) – Filter by runs whose name contains this substring.

  • status (RunStatus | list[RunStatus] | None) – Filter by status. Can be a single status or a list of statuses.

  • tags (list[str] | None) – Filter by tags. Returns runs that have ALL specified tags.

  • limit (int | None) – Maximum number of runs to return. If None, returns all matching runs.

Returns:

A list of run IDs matching the filters.

Return type:

list[RunID]

rush.client.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)

rush.client.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.client.set_opts(workspace_dir=None)[source]

Sets Rush options. Currently, only allows setting the workspace directory.

Parameters:

workspace_dir (Path | None)

rush.client.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])

rush.client.RunStatus

pending runs are queued for submission to a target.

Type:

All self-explanatory

alias of Literal[‘pending’, ‘running’, ‘done’, ‘error’, ‘cancelled’, ‘draft’]

rush.client.StorageUnit

Valid values for the storage_units field of RunSpec.

alias of Literal[‘KB’, ‘MB’, ‘GB’]

rush.client.Target

Valid values for the target field of RunSpec.

alias of Literal[‘Bullet’, ‘Bullet2’, ‘Bullet3’, ‘Gadi’, ‘Setonix’]