Runner API#
This is the highest level module that manages the MLFlow run and runs the calculation
- tsadar.runner.load_and_make_folders(cfg_path: str) Tuple[str, Dict]Source#
This is used to queue runs on NERSC
- Parameters:
cfg_path – path to the config folder
- Returns:
run_id – mlflow run id all_configs: dictionary of all configs
- tsadar.runner.run(cfg_path: str, mode: str) strSource#
Wrapper for lower level runner
- Parameters:
cfg_path – path to the config folder
mode – either “fit” or “forward”
- Returns:
run_id – mlflow run id
- tsadar.runner.run_for_app(run_id: str) strSource#
Dedicated run wrapper for the web app. Downloads the config and data files from the MLflow run’s artifact URI, updates the configuration with local file paths, and executes the main run method in “fit” mode.
- Parameters:
run_id (str) – The MLflow run ID to resume or use for logging.
- Returns:
str – The MLflow run ID used for this execution.
- Side Effects:
Downloads files to a temporary directory.
May modify the configuration dictionary in memory.
Executes the main application logic via _run_.
- tsadar.runner._run_(config: Dict, mode: str = 'fit')Source#
Either performs a forward pass or an entire fitting routine
Relies on mlflow to log parameters, metrics, and artifacts
- Parameters:
config – configuration dictionary
mode – either “fit” or “forward”
"fit" (-) – runs the fitting routine
"forward" (-) – runs the forward pass
- Returns:
None
Notes
The function logs the total time taken for the operation and the number of CPU cores used.
It also sets a status tag in MLflow to indicate completion.
- tsadar.runner.run_job(run_id: str, mode: str, nested: bool)Source#
This is used to run queued runs on NERSC. It picks up the run_id and finds that using MLFlow and does the fitting
- Parameters:
run_id – mlflow run id
mode – either “fit” or “forward”
nested – whether to start a nested run or not
True (- If)
context. (starts a nested run within the current MLflow run)
False (- If)
run. (starts a new)
- Returns:
None
Note
The function downloads the configuration files from the MLflow run’s artifact URI to a temporary directory.
It flattens and unflattens the configuration dictionary for easier manipulation.
The _run_ function is called to execute the main application logic with the provided mode.