sup3r.utilities.cli.BaseCLI#
- class BaseCLI[source]#
Bases:
object
Base CLI class used to create CLI for modules in ModuleName
Methods
add_status_cmd
(config, pipeline_step, cmd)Append status file command to command for executing given module
check_module_name
(module_name)Make sure module_name is a valid member of the ModuleName class
from_config
(module_name, module_class, ctx, ...)Run sup3r module from a config file.
from_config_preflight
(module_name, ctx, ...)Parse conifg file prior to running sup3r module.
kickoff_local_job
(module_name, ctx, cmd[, ...])Run sup3r module locally.
kickoff_slurm_job
(module_name, ctx, cmd[, ...])Run sup3r module on HPC via SLURM job submission.
- classmethod from_config(module_name, module_class, ctx, config_file, verbose, pipeline_step=None)[source]#
Run sup3r module from a config file.
- Parameters:
module_name (str) – Module name string from
sup3r.utilities.ModuleName
.module_class (Object) – Class object used to call get_node_cmd(config). e.g. Sup3rQa.get_node_cmd(config)
ctx (click.pass_context) – Click context object where ctx.obj is a dictionary
config_file (str) – Path to config file provided all needed inputs to module_class
verbose (bool) – Whether to run in verbose mode.
pipeline_step (str, optional) – Name of the pipeline step being run. If
None
, thepipeline_step
will be set to themodule_name
, mimicking old reV behavior. By default,None
.
- classmethod from_config_preflight(module_name, ctx, config_file, verbose)[source]#
Parse conifg file prior to running sup3r module.
- Parameters:
module_name (str) – Module name string from
sup3r.utilities.ModuleName
.module_class (Object) – Class object used to call get_node_cmd(config). e.g. Sup3rQa.get_node_cmd(config)
ctx (click.pass_context) – Click context object where ctx.obj is a dictionary
config_file (str) – Path to config file provided all needed inputs to module_class
verbose (bool) – Whether to run in verbose mode.
- Returns:
config (dict) – Dictionary corresponding to config_file
- classmethod check_module_name(module_name)[source]#
Make sure module_name is a valid member of the ModuleName class
- classmethod kickoff_slurm_job(module_name, ctx, cmd, alloc='sup3r', memory=None, walltime=4, feature=None, stdout_path='./stdout/', pipeline_step=None)[source]#
Run sup3r module on HPC via SLURM job submission.
- Parameters:
module_name (str) – Module name string from
sup3r.utilities.ModuleName
.ctx (click.pass_context) – Click context object where ctx.obj is a dictionary
cmd (str) –
- Command to be submitted in SLURM shell script. Example:
‘python -m sup3r.cli <module_name> -c <config_file>’
alloc (str) – HPC project (allocation) handle. Example: ‘sup3r’.
memory (int) – Node memory request in GB.
walltime (float) – Node walltime request in hours.
feature (str) – Additional flags for SLURM job. Format is “–qos=high” or “–depend=[state:job_id]”. Default is None.
stdout_path (str) – Path to print .stdout and .stderr files.
pipeline_step (str, optional) – Name of the pipeline step being run. If
None
, thepipeline_step
will be set to themodule_name
, mimicking old reV behavior. By default,None
.
- classmethod kickoff_local_job(module_name, ctx, cmd, pipeline_step=None)[source]#
Run sup3r module locally.
- Parameters:
module_name (str) – Module name string from
sup3r.utilities.ModuleName
.ctx (click.pass_context) – Click context object where ctx.obj is a dictionary
cmd (str) –
- Command to be submitted in shell script. Example:
‘python -m sup3r.cli <module_name> -c <config_file>’
pipeline_step (str, optional) – Name of the pipeline step being run. If
None
, thepipeline_step
will be set to themodule_name
, mimicking old reV behavior. By default,None
.
- classmethod add_status_cmd(config, pipeline_step, cmd)[source]#
Append status file command to command for executing given module
- Parameters:
config (dict) – sup3r config with all necessary args and kwargs to run given module.
pipeline_step (str) – Name of the pipeline step being run.
cmd (str) – String including command to execute given module.
- Returns:
cmd (str) – Command string with status file command included if job_name is not None