Slurm
Command-line interface for preparing SLURM submission scripts for simulations.
add_slurm_subparser(subparsers)
¶
Adds the 'slurm' subcommand to the Simlify CLI for rendering and writing SLURM files.
This function configures an argparse
subparser named 'slurm' which allows
users to specify the directory where the SLURM script should be written, the
path for the SLURM submission script relative to that directory, and optional
YAML configuration files to customize the SLURM settings.
PARAMETER | DESCRIPTION |
---|---|
subparsers
|
An
|
RETURNS | DESCRIPTION |
---|---|
The configured |
The 'slurm' subcommand accepts the following arguments:
dir_write
: Directory to write the SLURM submission script and potentially other input files.path_slurm_write
: Local path to write the SLURM submission script, relative to thedir_write
. For example, ifdir_write
is/home/user/simulations
andpath_slurm_write
issubmit.sh
, the script will be written to/home/user/simulations/submit.sh
.--yaml
: One or more paths to YAML configuration files. These files will be loaded in the order provided, with later files overriding settings from earlier ones. This allows users to specify default SLURM settings in a base YAML file and then override specific parameters for a particular simulation using another YAML file.
The function sets the default action for this subparser to be the
cli_slurm_prep
function, which will be called when the user invokes
the 'slurm' subcommand.
cli_extract_atoms(args, parser)
¶
Command-line interface function to prepare SLURM submission scripts.
This function serves as the entry point when the user executes the 'slurm'
subcommand of the Simlify CLI. It receives the parsed command-line arguments
and the argument parser object. It initializes a SimlifyConfig
object and
loads configuration settings from any YAML files provided via the --yaml
argument, with later files taking precedence. It then sets the SLURM job name
from the args.name_job
attribute (which should be added by a higher-level
parser or configuration). Finally, it calls the run_slurm_prep
function from
the simlify.simulation.slurm
module to create the SLURM submission script.
PARAMETER | DESCRIPTION |
---|---|
args
|
An
TYPE:
|
parser
|
The argument parser object for the 'slurm' subcommand, used to display help messages if necessary (though not explicitly used in this function).
TYPE:
|
The function retrieves the following arguments from the args
object:
dir_write
: The directory where the SLURM script will be written.path_slurm_write
: The path to the SLURM script relative todir_write
.yaml
: A list of paths to YAML configuration files.name_job
: The name of the SLURM job (expected to be set elsewhere).
It initializes a SimlifyConfig
, loads YAML configurations in reverse order
of precedence, sets the SLURM job name, and then calls run_slurm_prep
to
perform the SLURM script preparation.