sage.utils.servers

Filename : servers.py Description : Single source of truth for per-server settings.

This module centralises everything that changes when Sage is run on a different machine: where data is saved, where the conda env lives, and how batch jobs are launched. A run is wired to a server with one switch – the SAGE_SERVER environment variable (or hostname auto-detection) – and every path, both in Python (config.py / dataset.py) and in the shell run scripts (sage/utils/run_base.sh), is derived from the same entry here.

Add a new machine by adding one Server to SERVERS below.

Shell side

The shell helpers read these same values via:

eval "$(python -m sage.utils.servers env)"

so there is no duplicated path list to keep in sync.

CLI

python -m sage.utils.servers name # resolved server name python -m sage.utils.servers show # human-readable dump python -m sage.utils.servers env # export KEY=VAL lines for the shell

Attributes

REPO_ROOT

SERVERS

Classes

Server

Everything that is specific to one machine.

Functions

get_server([name])

Resolve the active server.

Module Contents

REPO_ROOT = ''[source]
class Server[source]

Everything that is specific to one machine.

Paths

home : the user’s home directory on that machine. data_root : parent dir under which data_release/ is created. This is

the big-storage mount where downloaded noise lands and from which training reads. Mirrors save_parent_dir of sage.data.primer.DataReleaseDownloader.

work_root : scratch / cache root (model compile caches, torch hub, etc.). repo_root : location of the sage checkout. Defaults to this checkout.

Launch

pythonabsolute path to the interpreter (conda env) for jobs. If

None the shell falls back to whatever python is on PATH.

scheduler : “slurm” or “local”. partition / qos / gres / time / cpus / mem / account / mail :

SLURM sbatch parameters (ignored when scheduler=”local”).

name: str[source]
hostmatch: tuple[str, Ellipsis][source]
home: str[source]
data_root: str[source]
work_root: str[source]
repo_root: str = ''[source]
python: str | None = None[source]
scheduler: str = 'local'[source]
partition: str = ''[source]
qos: str = ''[source]
gres: str = ''[source]
time: str = ''[source]
cpus: int = 4[source]
mem: str = ''[source]
account: str = ''[source]
mail: str = ''[source]
property data_release_root: str[source]
Return type:

str

dataset_dir(run)[source]

e.g. <data_root>/data_release/o3b_dataset

Parameters:

run (str)

Return type:

str

data_dir(run)[source]

The per-run data_dir (recolour PSDs etc.).

Parameters:

run (str)

Return type:

str

noise_bin(detector, run)[source]

Monolithic noise .bin for one detector / observing run.

Parameters:
Return type:

str

SERVERS: dict[str, Server][source]
get_server(name=None)[source]

Resolve the active server.

Order: explicit name arg -> $SAGE_SERVER -> hostname auto-detect. Raises a clear error (listing valid names and the current hostname) if it cannot be determined, so a run never silently writes to the wrong place.

Parameters:

name (str | None)

Return type:

Server