tracdap.rt.launch¶
Helper functions for launching models
Functions¶
|
Launch a TRAC job using external configuration files |
|
Launch an individual model using its Python class |
Package Contents¶
- tracdap.rt.launch.launch_job(job_config, sys_config, **launch_args)¶
Launch a TRAC job using external configuration files
This function launches the job definition supplied in the job_config file, which must contain enough information to describe the job along with any models and other resources that it needs. It allows for running more complex job types such as
JobType.RUN_FLOW
. If the job depends on external resources, those must be specified in the sys_config file.This method is intended for launching jobs during local development for debugging and testing, dev_mode = True is set by default. To test a job without using dev mode, pass dev_mode = False as a keyword parameter.
To resolve the paths of the job and system config files, paths are tried in the following order:
If an absolute path is supplied, this takes priority
Resolve relative to the current working directory
Search relative to parents of the current directory
Resolve relative to the directory containing the model
Search relative to parents of the directory containing the model
For code cloned from a Git repository, searches will not look outside the repository. Setting dev_mode = False will disable this search behavior, config file paths must be specified exactly when dev_mode = False.
- Parameters:
job_config (
pathlib.Path
| str) – Path to the job configuration filesys_config (
pathlib.Path
| str) – Path to the system configuration filelaunch_args – Additional arguments to control behavior of the TRAC runtime (not normally required)
- tracdap.rt.launch.launch_model(model_class, job_config, sys_config, **launch_args)¶
Launch an individual model using its Python class
This function launches the supplied model class directly, it must be called from the Python codebase containing the model class. A minimal job config is required to specify the parameters, inputs and outputs of the model. TRAC will set up the rest of the job configuration automatically.
This method is intended for launching models during local development for debugging and testing, dev_mode = True is set by default. To test a model without using dev mode, pass dev_mode = False as a keyword parameter.
To resolve the paths of the job and system config files, paths are tried in the following order:
If an absolute path is supplied, this takes priority
Resolve relative to the current working directory
Search relative to parents of the current directory
Resolve relative to the directory containing the model
Search relative to parents of the directory containing the model
For code cloned from a Git repository, searches will not look outside the repository. Setting dev_mode = False will disable this search behavior, config file paths must be specified exactly when dev_mode = False.
- Parameters:
model_class (
TracModel.__class__
) – The model class that will be launchedjob_config (
pathlib.Path
| str) – Path to the job configuration filesys_config (
pathlib.Path
| str) – Path to the system configuration filelaunch_args – Additional arguments to control behavior of the TRAC runtime (not normally required)