Skip to content

Commit

Permalink
Allow users to override the default account at setup time
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidHuber-NOAA committed Nov 26, 2024
1 parent 1563594 commit afa7258
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/source/setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The following command examples include variables for reference but users should

cd workflow
./setup_expt.py gfs forecast-only --idate $IDATE --edate $EDATE [--app $APP] [--start $START] [--interval $INTERVAL_GFS] [--resdetatmos $RESDETATMOS] [--resdetocean $RESDETOCEAN]
[--pslot $PSLOT] [--configdir $CONFIGDIR] [--comroot $COMROOT] [--expdir $EXPDIR]
[--pslot $PSLOT] [--configdir $CONFIGDIR] [--comroot $COMROOT] [--expdir $EXPDIR] [--account $ACCOUNT]

where:

Expand All @@ -61,6 +61,7 @@ where:
* ``$INTERVAL_GFS`` is the forecast interval in hours [default: 6]
* ``$COMROOT`` is the path to your experiment output directory. Your ``ROTDIR`` (rotating com directory) will be created using ``COMROOT`` and ``PSLOT``. [default: $HOME (but do not use default due to limited space in home directories normally, provide a path to a larger scratch space)]
* ``$EXPDIR`` is the path to your experiment directory where your configs will be placed and where you will find your workflow monitoring files (i.e. rocoto database and xml file). DO NOT include PSLOT folder at end of path, it will be built for you. [default: $HOME]
* ``$ACCOUNT`` is the HPC (i.e. slurm or PBS) account to use for the experiment. [default: $HPC_ACCOUNT; if $HPC_ACCOUNT is not set, then the default in the host file (workflow/hosts/<machine>.yaml) will be used]

Examples:

Expand Down
1 change: 1 addition & 0 deletions workflow/generate_workflows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ while [[ $# -gt 0 && "$1" != "--" ]]; do
t) _tag="_${OPTARG}" ;;
v) _verbose=true ;;
V) _very_verbose=true && _verbose=true && _verbose_flag="-v" ;;
A) _set_account=true && _hpc_account="${OPTARG}" ;;
d) _debug=true && _very_verbose=true && _verbose=true && _verbose_flag="-v" && PS4='${LINENO}: ' ;;
h) _usage && exit 0 ;;
:)
Expand Down
5 changes: 5 additions & 0 deletions workflow/setup_expt.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ def _common_args(parser):
parser.add_argument('--idate', help='starting date of experiment, initial conditions must exist!',
required=True, type=lambda dd: to_datetime(dd))
parser.add_argument('--edate', help='end date experiment', required=False, type=lambda dd: to_datetime(dd))
parser.add_argument('--account', help='HPC account to use; default is host-dependent', required=False, default=os.getenv('HPC_ACCOUNT'))
parser.add_argument('--interval', help='frequency of forecast (in hours); must be a multiple of 6', type=_validate_interval, required=False, default=6)
parser.add_argument('--icsdir', help='full path to user initial condition directory', type=str, required=False, default='')
parser.add_argument('--overwrite', help='overwrite previously created experiment (if it exists)',
Expand Down Expand Up @@ -407,6 +408,10 @@ def main(*argv):

validate_user_request(host, user_inputs)

# Update the default host account if the user supplied one
if user_inputs.account != "":
host.info.ACCOUNT = user_inputs.account

# Determine ocean resolution if not provided
if user_inputs.resdetocean <= 0:
user_inputs.resdetocean = get_ocean_resolution(user_inputs.resdetatmos)
Expand Down

0 comments on commit afa7258

Please sign in to comment.