Skip to content

Commit

Permalink
Updates to CI to clarify HOMEgfs (NOAA-EMC#1931)
Browse files Browse the repository at this point in the history
* replace HOMEgfs_PR with HOMEgfs, and HOMEgfs with ROOT_DIR. ROOT_DIR is the location where the ci scripts live
* update type to system in case yamls
* move create_experiment.py to workflow/
* detect HOMEgfs in create_experiment.py based on location.  update to use jinja templates in the cases
* remove export of HOMEgfs from driver.sh
  • Loading branch information
aerorahul committed Oct 17, 2023
1 parent bfea259 commit 3de102c
Show file tree
Hide file tree
Showing 20 changed files with 153 additions and 152 deletions.
10 changes: 5 additions & 5 deletions ci/cases/pr/C48_ATM.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
experiment:
type: gfs
system: gfs
mode: forecast-only

arguments:
pslot: ${pslot}
pslot: {{ 'pslot' | getenv }}
app: ATM
resdet: 48
comrot: ${RUNTESTS}/COMROT
expdir: ${RUNTESTS}/EXPDIR
comrot: {{ 'RUNTESTS' | getenv }}/COMROT
expdir: {{ 'RUNTESTS' | getenv }}/EXPDIR
idate: 2021032312
edate: 2021032312
yaml: ${HOMEgfs_PR}/ci/platforms/gfs_defaults_ci-updates.yaml
yaml: {{ HOMEgfs }}/ci/platforms/gfs_defaults_ci.yaml
12 changes: 6 additions & 6 deletions ci/cases/pr/C48_S2SA_gefs.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
experiment:
type: gefs
system: gefs
mode: forecast-only

arguments:
pslot: ${pslot}
pslot: {{ 'pslot' | getenv }}
app: S2SA
resdet: 48
resens: 48
nens: 2
gfs_cyc: 1
comrot: ${RUNTESTS}/COMROT
expdir: ${RUNTESTS}/EXPDIR
icsdir: ${ICSDIR_ROOT}/C48C48mx500
comrot: {{ 'RUNTESTS' | getenv }}/COMROT
expdir: {{ 'RUNTESTS' | getenv }}/EXPDIR
icsdir: {{ 'ICSDIR_ROOT' | getenv }}/C48C48mx500
idate: 2021032312
edate: 2021032312
yaml: ${HOMEgfs_PR}/ci/platforms/gefs_ci_defaults.yaml
yaml: {{ HOMEgfs }}/ci/platforms/gefs_ci_defaults.yaml
10 changes: 5 additions & 5 deletions ci/cases/pr/C48_S2SW.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
experiment:
type: gfs
system: gfs
mode: forecast-only

arguments:
pslot: ${pslot}
pslot: {{ 'pslot' | getenv }}
app: S2SW
resdet: 48
comrot: ${RUNTESTS}/COMROT
expdir: ${RUNTESTS}/EXPDIR
comrot: {{ 'RUNTESTS' | getenv }}/COMROT
expdir: {{ 'RUNTESTS' | getenv }}/EXPDIR
idate: 2021032312
edate: 2021032312
yaml: ${HOMEgfs_PR}/ci/platforms/gfs_defaults_ci-updates.yaml
yaml: {{ HOMEgfs }}/ci/platforms/gfs_defaults_ci.yaml
12 changes: 6 additions & 6 deletions ci/cases/pr/C96C48_hybatmDA.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
experiment:
type: gfs
system: gfs
mode: cycled

arguments:
pslot: ${pslot}
pslot: {{ 'pslot' | getenv }}
app: ATM
resdet: 96
resens: 48
comrot: ${RUNTESTS}/COMROT
expdir: ${RUNTESTS}/EXPDIR
icsdir: ${ICSDIR_ROOT}/C96C48
comrot: {{ 'RUNTESTS' | getenv }}/COMROT
expdir: {{ 'RUNTESTS' | getenv }}/EXPDIR
icsdir: {{ 'ICSDIR_ROOT' | getenv }}/C96C48
idate: 2021122018
edate: 2021122106
nens: 2
gfs_cyc: 1
start: cold
yaml: ${HOMEgfs_PR}/ci/platforms/gfs_defaults_ci-updates.yaml
yaml: {{ HOMEgfs }}/ci/platforms/gfs_defaults_ci.yaml
10 changes: 5 additions & 5 deletions ci/cases/pr/C96_atm3DVar.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
experiment:
type: gfs
system: gfs
mode: cycled

arguments:
pslot: ${pslot}
pslot: {{ 'pslot' | getenv }}
app: ATM
resdet: 96
comrot: ${RUNTESTS}/COMROT
expdir: ${RUNTESTS}/EXPDIR
comrot: {{ 'RUNTESTS' | getenv }}/COMROT
expdir: {{ 'RUNTESTS' | getenv }}/EXPDIR
icsdir: ${ICSDIR_ROOT}/C96C48
idate: 2021122018
edate: 2021122106
nens: 0
gfs_cyc: 1
start: cold
yaml: ${HOMEgfs_PR}/ci/platforms/gfs_defaults_ci-updates.yaml
yaml: {{ HOMEgfs }}/ci/platforms/gfs_defaults_ci.yaml
12 changes: 6 additions & 6 deletions ci/cases/weekly/C384C192_hybatmda.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
experiment:
type: gfs
system: gfs
mode: cycled

arguments:
pslot: ${pslot}
pslot: {{ 'pslot' | getenv }}
app: ATM
resdet: 384
resens: 192
comrot: ${RUNTESTS}/COMROT
expdir: ${RUNTESTS}/EXPDIR
icsdir: ${ICSDIR_ROOT}/C384C192
comrot: {{ 'RUNTESTS' | getenv }}/COMROT
expdir: {{ 'RUNTESTS' | getenv }}/EXPDIR
icsdir: {{ 'ICSDIR_ROOT' | getenv }}/C384C192
idate: 2023040118
edate: 2023040200
nens: 2
gfs_cyc: 1
start: cold
yaml: ${HOMEgfs_PR}/ci/platforms/gfs_defaults_ci-updates.yaml
yaml: {{ HOMEgfs }}/ci/platforms/gfs_defaults_ci.yaml
10 changes: 5 additions & 5 deletions ci/cases/weekly/C384_S2SWA.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
experiment:
type: gfs
system: gfs
mode: forecast-only

arguments:
pslot: ${pslot}
pslot: {{ 'pslot' | getenv }}
app: S2SWA
resdet: 384
comrot: ${RUNTESTS}/COMROT
expdir: ${RUNTESTS}/EXPDIR
comrot: {{ 'RUNTESTS' | getenv }}/COMROT
expdir: {{ 'RUNTESTS' | getenv }}/EXPDIR
idate: 2016070100
edate: 2016070100
yaml: ${HOMEgfs_PR}/ci/platforms/gfs_defaults_ci-updates.yaml
yaml: {{ HOMEgfs }}/ci/platforms/gfs_defaults_ci.yaml
12 changes: 6 additions & 6 deletions ci/cases/weekly/C384_atm3DVar.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
experiment:
type: gfs
system: gfs
mode: cycled

arguments:
pslot: ${pslot}
pslot: {{ 'pslot' | getenv }}
app: ATM
resdet: 384
resens: 192
comrot: ${RUNTESTS}/COMROT
expdir: ${RUNTESTS}/EXPDIR
icsdir: ${ICSDIR_ROOT}/C384C192
comrot: {{ 'RUNTESTS' | getenv }}/COMROT
expdir: {{ 'RUNTESTS' | getenv }}/EXPDIR
icsdir: {{ 'ICSDIR_ROOT' | getenv }}/C384C192
idate: 2023040118
edate: 2023040200
nens: 0
gfs_cyc: 1
start: cold
yaml: ${HOMEgfs_PR}/ci/platforms/gfs_defaults_ci-updates.yaml
yaml: {{ HOMEgfs }}/ci/platforms/gfs_defaults_ci.yaml
File renamed without changes.
24 changes: 12 additions & 12 deletions ci/scripts/check_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
set -eux
#####################################################################################
#
# Script description: BASH script for checking for cases in a given PR and
# Script description: BASH script for checking for cases in a given PR and
# running rocotostat on each to determine if the experiment has
# succeeded or faild. This script is intended
# to run from within a cron job in the CI Managers account
#####################################################################################

HOMEgfs="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." >/dev/null 2>&1 && pwd )"
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." >/dev/null 2>&1 && pwd )"
scriptname=$(basename "${BASH_SOURCE[0]}")
echo "Begin ${scriptname} at $(date -u)" || true
export PS4='+ $(basename ${BASH_SOURCE})[${LINENO}]'
Expand All @@ -20,20 +20,20 @@ REPO_URL="https://github.com/NOAA-EMC/global-workflow.git"
# Set up runtime environment varibles for accounts on supproted machines
#########################################################################

source "${HOMEgfs}/ush/detect_machine.sh"
source "${ROOT_DIR}/ush/detect_machine.sh"
case ${MACHINE_ID} in
hera | orion)
echo "Running Automated Testing on ${MACHINE_ID}"
source "${HOMEgfs}/ci/platforms/config.${MACHINE_ID}"
source "${ROOT_DIR}/ci/platforms/config.${MACHINE_ID}"
;;
*)
echo "Unsupported platform. Exiting with error."
exit 1
;;
esac
set +x
source "${HOMEgfs}/ush/module-setup.sh"
module use "${HOMEgfs}/modulefiles"
source "${ROOT_DIR}/ush/module-setup.sh"
module use "${ROOT_DIR}/modulefiles"
module load "module_gwsetup.${MACHINE_ID}"
module list
set -x
Expand All @@ -56,7 +56,7 @@ pr_list_dbfile="${GFS_CI_ROOT}/open_pr_list.db"

pr_list=""
if [[ -f "${pr_list_dbfile}" ]]; then
pr_list=$("${HOMEgfs}/ci/scripts/pr_list_database.py" --dbfile "${pr_list_dbfile}" --display | grep -v Failed | grep Running | awk '{print $1}') || true
pr_list=$("${ROOT_DIR}/ci/scripts/pr_list_database.py" --dbfile "${pr_list_dbfile}" --display | grep -v Failed | grep Running | awk '{print $1}') || true
fi
if [[ -z "${pr_list+x}" ]]; then
echo "no PRs open and ready to run cases on .. exiting"
Expand Down Expand Up @@ -85,7 +85,7 @@ for pr in ${pr_list}; do
"${GH}" pr edit --repo "${REPO_URL}" "${pr}" --remove-label "CI-${MACHINE_ID^}-Running" --add-label "CI-${MACHINE_ID^}-Passed"
sed -i "s/\`\`\`//2g" "${GFS_CI_ROOT}/PR/${pr}/output_${id}"
"${GH}" pr comment "${pr}" --repo "${REPO_URL}" --body-file "${GFS_CI_ROOT}/PR/${pr}/output_${id}"
"${HOMEgfs}/ci/scripts/pr_list_database.py" --remove_pr "${pr}" --dbfile "${pr_list_dbfile}"
"${ROOT_DIR}/ci/scripts/pr_list_database.py" --remove_pr "${pr}" --dbfile "${pr_list_dbfile}"
# Check to see if this PR that was opened by the weekly tests and if so close it if it passed on all platforms
weekly_labels=$(${GH} pr view "${pr}" --repo "${REPO_URL}" --json headRefName,labels,author --jq 'select(.author.login | contains("emcbot")) | select(.headRefName | contains("weekly_ci")) | .labels[].name ') || true
if [[ -n "${weekly_labels}" ]]; then
Expand All @@ -103,8 +103,8 @@ for pr in ${pr_list}; do
fi
# Completely remove the PR and its cloned repo on sucess
# of all cases on this platform
rm -Rf "${pr_dir}"
continue
rm -Rf "${pr_dir}"
continue
fi

for pslot_dir in "${pr_dir}/RUNTESTS/EXPDIR/"*; do
Expand Down Expand Up @@ -134,10 +134,10 @@ for pr in ${pr_list}; do
{
echo "Error logs:"
echo "${error_logs}"
} >> "${GFS_CI_ROOT}/PR/${pr}/output_${id}"
} >> "${GFS_CI_ROOT}/PR/${pr}/output_${id}"
sed -i "s/\`\`\`//2g" "${GFS_CI_ROOT}/PR/${pr}/output_${id}"
"${GH}" pr comment "${pr}" --repo "${REPO_URL}" --body-file "${GFS_CI_ROOT}/PR/${pr}/output_${id}"
"${HOMEgfs}/ci/scripts/pr_list_database.py" --remove_pr "${pr}" --dbfile "${pr_list_dbfile}"
"${ROOT_DIR}/ci/scripts/pr_list_database.py" --remove_pr "${pr}" --dbfile "${pr_list_dbfile}"
for kill_cases in "${pr_dir}/RUNTESTS/"*; do
pslot=$(basename "${kill_cases}")
sacct --format=jobid,jobname%35,WorkDir%100,stat | grep "${pslot}" | grep "PR\/${pr}\/RUNTESTS" | awk '{print $1}' | xargs scancel || true
Expand Down
4 changes: 2 additions & 2 deletions ci/scripts/clone-build_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ usage() {
echo
echo "Usage: $0 -p <PR#> -d <directory> -o <output> -h"
echo
echo " -p PR nunber to clone and build"
echo " -d Full path of <directory> of were to clone and build PR"
echo " -p PR number to clone and build"
echo " -d Full path of <directory> of where to clone and build PR"
echo " -o Full path to output message file detailing results of CI tests"
echo " -h display this message and quit"
echo
Expand Down
Loading

0 comments on commit 3de102c

Please sign in to comment.