tracdap.rt.launch

Helper functions for launching models

Functions

launch_job(job_config, sys_config[, dev_mode])

Launch a TRAC job using external configuration files

launch_model(model_class, job_config, sys_config, ...)

Launch an individual model using its Python class

Package Contents

tracdap.rt.launch.launch_job(job_config, sys_config, dev_mode=False, **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 and can be used for local development by setting dev_mode = True. If the job depends on external resources, those must be specified in the sys_config file.

To resolve the paths of the job and system config files, paths are tried in the following order:

  1. If an absolute path is supplied, this takes priority

  2. Resolve relative to the current working directory

Parameters:
  • job_config (pathlib.Path | str) – Path to the job configuration file

  • sys_config (pathlib.Path | str) – Path to the system configuration file

  • dev_mode (bool) – Whether to launch in dev mode (applies dev mode translation to the job inputs)

  • launch_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. The TRAC runtime will launch in dev mode and execute the model inside the current Python process, a minimal job definition and set of local resources will be configured automatically. This method is useful for launching models during local development for debugging and testing.

To resolve the paths of the job and system config files, paths are tried in the following order:

  1. If an absolute path is supplied, this takes priority

  2. Resolve relative to the current working directory

  3. Resolve relative to the directory containing the Python module of the model

Parameters:
  • model_class (TracModel.__class__) – The model class that will be launched

  • job_config (pathlib.Path | str) – Path to the job configuration file

  • sys_config (pathlib.Path | str) – Path to the system configuration file

  • launch_args – Additional arguments to control behavior of the TRAC runtime (not normally required)