Skip to content

Commit

Permalink
PR edits
Browse files Browse the repository at this point in the history
  • Loading branch information
ppinchuk committed Oct 5, 2023
1 parent a162ed1 commit 52840a3
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 28 deletions.
4 changes: 2 additions & 2 deletions sup3r/bias/bias_calc_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import sup3r.bias.bias_calc
from sup3r.utilities import ModuleName
from sup3r.utilities.cli import BaseCLI
from sup3r.utilities.cli import AVAILABLE_HARDWARE_OPTIONS, BaseCLI
from sup3r.version import __version__

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -62,7 +62,7 @@ def from_config(ctx, config_file, verbose=False, **__):
cmd_log = '\n\t'.join(cmd.split('\n'))
logger.debug(f'Running command:\n\t{cmd_log}')

if hardware_option.lower() in ('kestrel', 'eagle', 'slurm'):
if hardware_option.lower() in AVAILABLE_HARDWARE_OPTIONS:
kickoff_slurm_job(ctx, cmd, **exec_kwargs)
else:
kickoff_local_job(ctx, cmd)
Expand Down
21 changes: 6 additions & 15 deletions sup3r/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,15 @@ def forward_pass(ctx, verbose):
},
},
"execution_control": {
"option": "local"
},
"execution_control_kestrel": {
"option": "kestrel",
"walltime": 4,
"alloc": "sup3r"
}
}
Note that the ``execution_control`` block will run the job locally,
while the ``execution_control_kestrel`` block are kwargs that would
Note that the ``execution_control`` block contains kwargs that would
be required to distribute the job on multiple nodes on the NREL HPC.
To run the job locally, use ``execution_control: {"option": "local"}``.
"""
config_file = ctx.obj['CONFIG_FILE']
verbose = any([verbose, ctx.obj['VERBOSE']])
Expand Down Expand Up @@ -165,18 +162,15 @@ def solar(ctx, verbose):
"fp_pattern": "./chunks/sup3r*.h5",
"nsrdb_fp": "/datasets/NSRDB/current/nsrdb_2015.h5",
"execution_control": {
"option": "local"
},
"execution_control_kestrel": {
"option": "kestrel",
"walltime": 4,
"alloc": "sup3r"
}
}
Note that the ``execution_control`` block will run the job locally,
while the ``execution_control_kestrel`` block are kwargs that would
Note that the ``execution_control`` block contains kwargs that would
be required to distribute the job on multiple nodes on the NREL HPC.
To run the job locally, use ``execution_control: {"option": "local"}``.
"""
config_file = ctx.obj['CONFIG_FILE']
verbose = any([verbose, ctx.obj['VERBOSE']])
Expand Down Expand Up @@ -229,18 +223,15 @@ def bias_calc(ctx, verbose):
}
],
"execution_control": {
"option": "local"
},
"execution_control_kestrel": {
"option": "kestrel",
"walltime": 4,
"alloc": "sup3r"
}
}
Note that the ``execution_control`` block will run the job locally,
while the ``execution_control_kestrel`` block are kwargs that would
Note that the ``execution_control`` block contains kwargs that would
be required to distribute the job on multiple nodes on the NREL HPC.
To run the job locally, use ``execution_control: {"option": "local"}``.
"""
config_file = ctx.obj['CONFIG_FILE']
verbose = any([verbose, ctx.obj['VERBOSE']])
Expand Down
4 changes: 2 additions & 2 deletions sup3r/pipeline/forward_pass_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from sup3r.utilities import ModuleName
from sup3r.version import __version__
from sup3r.pipeline.forward_pass import ForwardPassStrategy, ForwardPass
from sup3r.utilities.cli import BaseCLI
from sup3r.utilities.cli import AVAILABLE_HARDWARE_OPTIONS, BaseCLI


logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -71,7 +71,7 @@ def from_config(ctx, config_file, verbose=False, **__):
cmd_log = '\n\t'.join(cmd.split('\n'))
logger.debug(f'Running command:\n\t{cmd_log}')

if hardware_option.lower() in ('kestrel', 'eagle', 'slurm'):
if hardware_option.lower() in AVAILABLE_HARDWARE_OPTIONS:
kickoff_slurm_job(ctx, cmd, **exec_kwargs)
else:
kickoff_local_job(ctx, cmd)
Expand Down
4 changes: 2 additions & 2 deletions sup3r/postprocessing/data_collect_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from sup3r.utilities import ModuleName
from sup3r.version import __version__
from sup3r.postprocessing.collection import Collector
from sup3r.utilities.cli import BaseCLI
from sup3r.utilities.cli import AVAILABLE_HARDWARE_OPTIONS, BaseCLI


logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -67,7 +67,7 @@ def from_config(ctx, config_file, verbose=False, **__):
cmd_log = '\n\t'.join(cmd.split('\n'))
logger.debug(f'Running command:\n\t{cmd_log}')

if hardware_option.lower() in ('kestrel', 'eagle', 'slurm'):
if hardware_option.lower() in AVAILABLE_HARDWARE_OPTIONS:
kickoff_slurm_job(ctx, cmd, **exec_kwargs)
else:
kickoff_local_job(ctx, cmd)
Expand Down
4 changes: 2 additions & 2 deletions sup3r/preprocessing/data_extract_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import sup3r
from sup3r.utilities import ModuleName
from sup3r.version import __version__
from sup3r.utilities.cli import BaseCLI
from sup3r.utilities.cli import AVAILABLE_HARDWARE_OPTIONS, BaseCLI


logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -57,7 +57,7 @@ def from_config(ctx, config_file, verbose=False, **__):
cmd_log = '\n\t'.join(cmd.split('\n'))
logger.debug(f'Running command:\n\t{cmd_log}')

if hardware_option.lower() in ('kestrel', 'eagle', 'slurm'):
if hardware_option.lower() in AVAILABLE_HARDWARE_OPTIONS:
kickoff_slurm_job(ctx, cmd, **exec_kwargs)
else:
kickoff_local_job(ctx, cmd)
Expand Down
4 changes: 2 additions & 2 deletions sup3r/solar/solar_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from sup3r.solar import Solar
from sup3r.utilities import ModuleName
from sup3r.version import __version__
from sup3r.utilities.cli import BaseCLI
from sup3r.utilities.cli import AVAILABLE_HARDWARE_OPTIONS, BaseCLI


logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -63,7 +63,7 @@ def from_config(ctx, config_file, verbose=False, **__):
cmd_log = '\n\t'.join(cmd.split('\n'))
logger.debug(f'Running command:\n\t{cmd_log}')

if hardware_option.lower() in ('kestrel', 'eagle', 'slurm'):
if hardware_option.lower() in AVAILABLE_HARDWARE_OPTIONS:
kickoff_slurm_job(ctx, cmd, **exec_kwargs)
else:
kickoff_local_job(ctx, cmd)
Expand Down
4 changes: 3 additions & 1 deletion sup3r/utilities/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@

from sup3r.utilities import ModuleName


logger = logging.getLogger(__name__)
AVAILABLE_HARDWARE_OPTIONS = ('kestrel', 'eagle', 'slurm')


class SlurmManager(SLURM):
Expand Down Expand Up @@ -72,7 +74,7 @@ def from_config(cls, module_name, module_class, ctx, config_file, verbose):
cmd_log = '\n\t'.join(cmd.split('\n'))
logger.debug(f'Running command:\n\t{cmd_log}')

if hardware_option.lower() in ('kestrel', 'eagle', 'slurm'):
if hardware_option.lower() in AVAILABLE_HARDWARE_OPTIONS:
cls.kickoff_slurm_job(module_name, ctx, cmd, **exec_kwargs)
else:
cls.kickoff_local_job(module_name, ctx, cmd)
Expand Down
4 changes: 2 additions & 2 deletions sup3r/utilities/regridder_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from sup3r.utilities import ModuleName
from sup3r.version import __version__
from sup3r.utilities.regridder import RegridOutput
from sup3r.utilities.cli import BaseCLI
from sup3r.utilities.cli import AVAILABLE_HARDWARE_OPTIONS, BaseCLI


logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -71,7 +71,7 @@ def from_config(ctx, config_file, verbose=False, **__):
cmd_log = '\n\t'.join(cmd.split('\n'))
logger.debug(f'Running command:\n\t{cmd_log}')

if hardware_option.lower() in ('kestrel', 'eagle', 'slurm'):
if hardware_option.lower() in AVAILABLE_HARDWARE_OPTIONS:
kickoff_slurm_job(ctx, cmd, **exec_kwargs)
else:
kickoff_local_job(ctx, cmd)
Expand Down

0 comments on commit 52840a3

Please sign in to comment.