Skip to content

Commit

Permalink
Add ability to add tag to pslots with generate_workflows
Browse files Browse the repository at this point in the history
`generate_workflows` would only use the case name as the pslot,
leading to conflicts if you try to run two different sets at the
same time. Now there is a new option that allows a 'tag' to the
case name when determining the pslots:

```
generate_workflows -t <tag>

tag: string to be added to end of case name
```

For example, this:

```
generate_workflows -t test
```

Will result in pslots of `C48_ATM_test`, `C48_S2SW_test`, etc.
  • Loading branch information
WalterKolczynski-NOAA committed Oct 25, 2024
1 parent 58737cb commit 909349c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions workflow/generate_workflows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ _hpc_account=""
_set_account=false
_update_cron=false
_email=""
_tag=""
_set_email=false
_verbose=false
_very_verbose=false
Expand All @@ -111,7 +112,7 @@ _runtests="${RUNTESTS:-${_runtests:-}}"
_nonflag_option_count=0

while [[ $# -gt 0 && "$1" != "--" ]]; do
while getopts ":H:bB:uy:Y:GESA:ce:vVdh" option; do
while getopts ":H:bB:uy:Y:GESA:ce:t:vVdh" option; do
case "${option}" in
H)
HOMEgfs="${OPTARG}"
Expand All @@ -138,6 +139,7 @@ while [[ $# -gt 0 && "$1" != "--" ]]; do
S) _run_all_sfs=true ;;
c) _update_cron=true ;;
e) _email="${OPTARG}" && _set_email=true ;;
t) _tag="_${OPTARG}";;
v) _verbose=true ;;
V) _very_verbose=true && _verbose=true && _verbose_flag="-v" ;;
d) _debug=true && _very_verbose=true && _verbose=true && _verbose_flag="-v" && PS4='${LINENO}: ' ;;
Expand Down Expand Up @@ -454,11 +456,12 @@ echo "Running create_experiment.py for ${#_yaml_list[@]} cases"
[[ "${_verbose}" == true ]] && printf "Selected cases: %s\n\n" "${_yaml_list[*]}"
for _case in "${_yaml_list[@]}"; do
[[ "${_verbose}" == false ]] && echo "${_case}"
_pslot="${_case}${_tag}"
_create_exp_cmd="./create_experiment.py -y ../ci/cases/pr/${_case}.yaml --overwrite"
if [[ "${_verbose}" == true ]]; then
pslot=${_case} RUNTESTS=${_runtests} ${_create_exp_cmd}
pslot=${_pslot} RUNTESTS=${_runtests} ${_create_exp_cmd}
else
if ! pslot=${_case} RUNTESTS=${_runtests} ${_create_exp_cmd} 2> stderr 1> stdout; then
if ! pslot=${_pslot} RUNTESTS=${_runtests} ${_create_exp_cmd} 2> stderr 1> stdout; then
_output=$(cat stdout stderr)
_message="The create_experiment command (${_create_exp_cmd}) failed with a non-zero status. Output:"
_message="${_message}"$'\n'"${_output}"
Expand All @@ -471,7 +474,7 @@ for _case in "${_yaml_list[@]}"; do
fi
rm -f stdout stderr
fi
grep "${_case}" "${_runtests}/EXPDIR/${_case}/${_case}.crontab" >> tests.cron
grep "${_pslot}" "${_runtests}/EXPDIR/${_pslot}/${_pslot}.crontab" >> tests.cron
done
echo

Expand Down

0 comments on commit 909349c

Please sign in to comment.