message_ix_models.model.transport.slurm.Template
- class message_ix_models.model.transport.slurm.Template[source]
Bases:
JinjaTemplateTemplate for use with mix-models sbatch.
Example usage:
mix-models sbatch -m model.transport --go -v branch=branch-to-run -v model_extra=debug -- --from="" "SSP2 reported" -- go
The script performs the following actions, tailored for the IIASA ‘UnICC’ cluster and SLURM:
Load necessary modules.
Use uv to install
message_ix_modelsand dependencies.Run mix-models transport run --go with additional arguments.
Copy output files (e.g. reporting) to a shared drive.
Methods
__init__()format([as_directives])Prepare arguments and standard input from the template and parameters.
from_module(module_name)Return the first instance of Template found in module_name.
prepare_parameters(parameters)Attributes
A list of
strin which:Default values for any parameters or substitution values used to format the
argv.Relative path of a file in
message_ix_models/data/.- argv: list[str] = ['sbatch', '--job-name={job_name}', '--mem=64G', '--output=/home/{username}/slurm/{job_name}-%J.out', '--time=2:00:00'][source]
A list of
strin which:The first entry should be the name or path of a program, for instance sbatch.
The final entry should be a script body to be passed as standard input to the program.
Any intermediate entries should be command-line arguments to the program.
- default_parameters: dict[str, str] = {'branch': 'main', 'job_name': 'MixT', 'model_extra': 'dev', 'nodes': 'R12', 'platform_dest': 'message-jdbc-pg', 'platform_src': 'ixmp-dev', 'python_version': '3.14', 'source': 'gitlab'}[source]
Default values for any parameters or substitution values used to format the
argv.
- file: PurePosixPath = PurePosixPath('transport/slurm.sh')[source]
Relative path of a file in
message_ix_models/data/. The documentation forjinja.Environment.get_template()states “‘/’ is used as the file system separator, even on Windows.”
- format(as_directives: bool = False, **parameters: Any) tuple[list[str], bytes][source]
Prepare arguments and standard input from the template and parameters.
- Parameters:
as_directives – If
True, options to sbatch are formatted as#SBATCHlines, immediately after the first line of the template body. IfFalse(default), they are returned as part of the arguments.- Returns:
with 2 elements:
A list of command arguments, length 1 or greater. The first is the name or path of an program, for instance “sbatch”. The remainder are parameters or options to the same program.
byteswith the formatted script body to be passed as standard input to the program.
- Return type: