ofa_site

Site-configuration loader for ofa.

Historically ofa hard-coded a handful of Kestrel-specific strings across bin/ofa, ofa_main.py and ofa_server.py (partition names, GRES strings, protected filesystem roots, the ssh -L login host in the BYOK hint, the banner subtitle, and so on). This module extracts those into a single optional $OFA_ROOT/site.toml file so ofa can be installed on a non-Kestrel HPC by editing one place.

Design goals:

  • Zero behavior change when ``site.toml`` is absent. The DEFAULTS dict below mirrors the Kestrel values that used to be inline, so an unmodified Kestrel checkout keeps operating identically whether or not a site.toml exists.

  • Additive override. Values in site.toml are deep-merged over DEFAULTS; missing keys keep their default. Users at Kestrel do not need to write a site.toml.

  • Bash-consumable. The shell launcher can eval the output of python3 -m ofa_site --shell-export to pick up the scheduler / module settings without parsing TOML in bash.

  • No dependency on the rest of ofa. Import order sanity: this module is imported from ofa_main and ofa_server at their top, so it must not import from either.

Functions

load_site()

Return the effective site config as a nested dict.

ofa_site.load_site()[source]

Return the effective site config as a nested dict.

Search order:
  1. $OFA_SITE_TOML if set and points to a readable file.

  2. $OFA_ROOT/site.toml if that file exists.

  3. Defaults only.

Any TOML parse error is swallowed and the defaults are returned; a broken site.toml must never disable ofa’s safety guards.

Return type:

dict[str, Any]