cellmap_flow.jobs.settings
The launcher’s settings: which queue, who is billed, how long a job may run.
One LauncherSettings per process, from launcher_settings(). It holds
one attribute per key of SERVER_CONFIG_DEFAULTS, the one place a key is
added, and cached: whether the values came from, or were saved to, the
file.
The settings cross processes through ~/.cellmap_flow/server_config.yaml, whose keys and format are what this module reads and writes:
launcher_settings()loads the file over the defaults the first time any code in the process asks, so a script, a blockwise master and the dashboard all get the saved values without asking for them.The CLIs apply their flags (
-q,-P) and a YAML’s values to it andsave()it; the dashboard’s /api/server-config does the same.start_hosts, the finetune submit and blockwise read it for their defaults.config.yaml.load_configreads the file itself, not this.
Nothing here is read at import: the file is opened on the first call, and
SERVER_CONFIG_PATH is looked up when the file is read or written, so a
test can point it elsewhere.
Attributes
Classes
The saved settings, one attribute per key, and |
Functions
|
Load server config from cache file. Returns None if not found. |
|
Save server config to cache file. |
|
This process's settings, loaded from the file on the first call. |
Module Contents
- cellmap_flow.jobs.settings.SERVER_CONFIG_PATH
- cellmap_flow.jobs.settings.SERVER_CONFIG_DEFAULTS
- cellmap_flow.jobs.settings.SERVER_CONFIG_KEYS = ['queue', 'charge_group', 'walltime', 'cycle_gpu_queues', 'nb_cores_master', 'nb_cores_worker',...
- cellmap_flow.jobs.settings.load_server_config_cache() Dict[str, Any] | None
Load server config from cache file. Returns None if not found.
- cellmap_flow.jobs.settings.save_server_config_cache(config: Dict[str, Any]) None
Save server config to cache file.
- class cellmap_flow.jobs.settings.LauncherSettings(values: Dict[str, Any] | None = None, cached: bool = False)
The saved settings, one attribute per key, and
cached.The slots come from the defaults, so a misspelt setting raises instead of being stored beside the real one, and a key added to the defaults is loaded and saved without being named anywhere else. (Assigning each key by hand is how adding “walltime” once gave save() a key no instance had, and every cellmap_flow yaml run died at startup.)
- cached = False
- classmethod load() LauncherSettings
The saved file over the defaults. A key the file lacks (it was saved before the key existed) gets its default.
- as_dict() Dict[str, Any]
{key: value}, every key, as the file holds them.
- save() None
Write every key to the file, for this and later processes.
- cellmap_flow.jobs.settings.launcher_settings() LauncherSettings
This process’s settings, loaded from the file on the first call.
Read it at call time, never into a module global: tests swap in fresh settings per test, and a copy taken at import would outlive them.