diff --git a/ci/cases/pr/C48_ATM.yaml b/ci/cases/pr/C48_ATM.yaml index ccb001d296..fc0b729af6 100644 --- a/ci/cases/pr/C48_ATM.yaml +++ b/ci/cases/pr/C48_ATM.yaml @@ -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 diff --git a/ci/cases/pr/C48_S2SA_gefs.yaml b/ci/cases/pr/C48_S2SA_gefs.yaml index 4d5f066858..927a979b13 100644 --- a/ci/cases/pr/C48_S2SA_gefs.yaml +++ b/ci/cases/pr/C48_S2SA_gefs.yaml @@ -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 diff --git a/ci/cases/pr/C48_S2SW.yaml b/ci/cases/pr/C48_S2SW.yaml index aba66cb4f3..f4b50ead22 100644 --- a/ci/cases/pr/C48_S2SW.yaml +++ b/ci/cases/pr/C48_S2SW.yaml @@ -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 diff --git a/ci/cases/pr/C96C48_hybatmDA.yaml b/ci/cases/pr/C96C48_hybatmDA.yaml index 660291a3be..c3aa6e8892 100644 --- a/ci/cases/pr/C96C48_hybatmDA.yaml +++ b/ci/cases/pr/C96C48_hybatmDA.yaml @@ -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 diff --git a/ci/cases/pr/C96_atm3DVar.yaml b/ci/cases/pr/C96_atm3DVar.yaml index f103f08d1f..5215cb0d90 100644 --- a/ci/cases/pr/C96_atm3DVar.yaml +++ b/ci/cases/pr/C96_atm3DVar.yaml @@ -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 diff --git a/ci/cases/weekly/C384C192_hybatmda.yaml b/ci/cases/weekly/C384C192_hybatmda.yaml index ca62c4e8f9..4c14018e2d 100644 --- a/ci/cases/weekly/C384C192_hybatmda.yaml +++ b/ci/cases/weekly/C384C192_hybatmda.yaml @@ -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 diff --git a/ci/cases/weekly/C384_S2SWA.yaml b/ci/cases/weekly/C384_S2SWA.yaml index d494efb44b..6c624f5698 100644 --- a/ci/cases/weekly/C384_S2SWA.yaml +++ b/ci/cases/weekly/C384_S2SWA.yaml @@ -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 diff --git a/ci/cases/weekly/C384_atm3DVar.yaml b/ci/cases/weekly/C384_atm3DVar.yaml index 99f302b9ca..e7986ef097 100644 --- a/ci/cases/weekly/C384_atm3DVar.yaml +++ b/ci/cases/weekly/C384_atm3DVar.yaml @@ -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 diff --git a/ci/platforms/gfs_defaults_ci-updates.yaml b/ci/platforms/gfs_defaults_ci.yaml similarity index 100% rename from ci/platforms/gfs_defaults_ci-updates.yaml rename to ci/platforms/gfs_defaults_ci.yaml diff --git a/ci/scripts/check_ci.sh b/ci/scripts/check_ci.sh index b2c8129d32..d5cf6a20bd 100755 --- a/ci/scripts/check_ci.sh +++ b/ci/scripts/check_ci.sh @@ -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}]' @@ -20,11 +20,11 @@ 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." @@ -32,8 +32,8 @@ case ${MACHINE_ID} in ;; 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 @@ -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" @@ -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 @@ -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 @@ -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 diff --git a/ci/scripts/clone-build_ci.sh b/ci/scripts/clone-build_ci.sh index 83f43ef54b..796e4b7014 100755 --- a/ci/scripts/clone-build_ci.sh +++ b/ci/scripts/clone-build_ci.sh @@ -9,8 +9,8 @@ usage() { echo echo "Usage: $0 -p -d -o -h" echo - echo " -p PR nunber to clone and build" - echo " -d Full path of of were to clone and build PR" + echo " -p PR number to clone and build" + echo " -d Full path of 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 diff --git a/ci/scripts/driver.sh b/ci/scripts/driver.sh index 0267d88e03..a79ecfd6cf 100755 --- a/ci/scripts/driver.sh +++ b/ci/scripts/driver.sh @@ -10,9 +10,8 @@ set -eux # # This script uses GitHub CLI to check for Pull Requests with CI-Ready-${machine} tags on the # development branch for the global-workflow repo. It then stages tests directories per -# PR number and calls clone-build_ci.sh to perform a clone and full build from $(HOMEgfs)/sorc -# of the PR. It then is ready to run a suite of regression tests with various -# configurations with run_tests.py. +# PR number and calls clone-build_ci.sh to perform a clone and full build from the PR. +# It then is ready to run a suite of regression tests with various configurations ####################################################################################### ################################################################# @@ -22,9 +21,9 @@ export GH=${HOME}/bin/gh export REPO_URL=${REPO_URL:-"https://github.com/NOAA-EMC/global-workflow.git"} ################################################################ -# Setup the reletive paths to scripts and PS4 for better logging +# Setup the reletive paths to scripts and PS4 for better logging ################################################################ -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}]' @@ -33,11 +32,11 @@ export PS4='+ $(basename ${BASH_SOURCE})[${LINENO}]' # 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." @@ -49,8 +48,8 @@ esac # setup runtime env for correct python install and git ###################################################### 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}" set -x @@ -61,45 +60,45 @@ set -x pr_list_dbfile="${GFS_CI_ROOT}/open_pr_list.db" if [[ ! -f "${pr_list_dbfile}" ]]; then - "${HOMEgfs}/ci/scripts/pr_list_database.py" --create --dbfile "${pr_list_dbfile}" + "${ROOT_DIR}/ci/scripts/pr_list_database.py" --create --dbfile "${pr_list_dbfile}" fi pr_list=$(${GH} pr list --repo "${REPO_URL}" --label "CI-${MACHINE_ID^}-Ready" --state "open" | awk '{print $1}') || true for pr in ${pr_list}; do pr_dir="${GFS_CI_ROOT}/PR/${pr}" - db_list=$("${HOMEgfs}/ci/scripts/pr_list_database.py" --add_pr "${pr}" --dbfile "${pr_list_dbfile}") + db_list=$("${ROOT_DIR}/ci/scripts/pr_list_database.py" --add_pr "${pr}" --dbfile "${pr_list_dbfile}") pr_id=0 ############################################################# - # Check if a Ready labeled PR has changed back from once set + # Check if a Ready labeled PR has changed back from once set # and in that case remove all previous jobs in scheduler and # and remove PR from filesystem to start clean ############################################################# if [[ "${db_list}" == *"already is in list"* ]]; then - pr_id=$("${HOMEgfs}/ci/scripts/pr_list_database.py" --dbfile "${pr_list_dbfile}" --display "${pr}" | awk '{print $4}') || true + pr_id=$("${ROOT_DIR}/ci/scripts/pr_list_database.py" --dbfile "${pr_list_dbfile}" --display "${pr}" | awk '{print $4}') || true pr_id=$((pr_id+1)) - "${HOMEgfs}/ci/scripts/pr_list_database.py" --dbfile "${pr_list_dbfile}" --update_pr "${pr}" Open Ready "${pr_id}" + "${ROOT_DIR}/ci/scripts/pr_list_database.py" --dbfile "${pr_list_dbfile}" --update_pr "${pr}" Open Ready "${pr_id}" for cases in "${pr_dir}/RUNTESTS/"*; do if [[ -z "${cases+x}" ]]; then break - fi + fi pslot=$(basename "${cases}") sacct --format=jobid,jobname%35,WorkDir%100,stat | grep "${pslot}" | grep "PR\/${pr}\/RUNTESTS" | awk '{print $1}' | xargs scancel || true done rm -Rf "${pr_dir}" - fi + fi done pr_list="" if [[ -f "${pr_list_dbfile}" ]]; then - pr_list=$("${HOMEgfs}/ci/scripts/pr_list_database.py" --display --dbfile "${pr_list_dbfile}" | grep -v Failed | grep Open | grep Ready | awk '{print $1}') || true + pr_list=$("${ROOT_DIR}/ci/scripts/pr_list_database.py" --display --dbfile "${pr_list_dbfile}" | grep -v Failed | grep Open | grep Ready | awk '{print $1}') || true fi if [[ -z "${pr_list+x}" ]]; then echo "no PRs open and ready for checkout/build .. exiting" exit 0 fi - + ############################################################# # Loop throu all open PRs # Clone, checkout, build, creat set of cases, for each @@ -107,12 +106,12 @@ fi for pr in ${pr_list}; do # Skip pr's that are currently Building for when overlapping driver scripts are being called from within cron - pr_building=$("${HOMEgfs}/ci/scripts/pr_list_database.py" --display "${pr}" --dbfile "${pr_list_dbfile}" | grep Building) || true + pr_building=$("${ROOT_DIR}/ci/scripts/pr_list_database.py" --display "${pr}" --dbfile "${pr_list_dbfile}" | grep Building) || true if [[ -z "${pr_building+x}" ]]; then continue fi "${GH}" pr edit --repo "${REPO_URL}" "${pr}" --remove-label "CI-${MACHINE_ID^}-Ready" --add-label "CI-${MACHINE_ID^}-Building" - "${HOMEgfs}/ci/scripts/pr_list_database.py" --dbfile "${pr_list_dbfile}" --update_pr "${pr}" Open Building + "${ROOT_DIR}/ci/scripts/pr_list_database.py" --dbfile "${pr_list_dbfile}" --update_pr "${pr}" Open Building echo "Processing Pull Request #${pr}" pr_dir="${GFS_CI_ROOT}/PR/${pr}" rm -Rf "${pr_dir}" @@ -120,7 +119,7 @@ for pr in ${pr_list}; do # call clone-build_ci to clone and build PR id=$("${GH}" pr view "${pr}" --repo "${REPO_URL}" --json id --jq '.id') set +e - "${HOMEgfs}/ci/scripts/clone-build_ci.sh" -p "${pr}" -d "${pr_dir}" -o "${pr_dir}/output_${id}" + "${ROOT_DIR}/ci/scripts/clone-build_ci.sh" -p "${pr}" -d "${pr_dir}" -o "${pr_dir}/output_${id}" ci_status=$? ################################################################## # Checking for special case when Ready label was updated @@ -128,14 +127,14 @@ for pr in ${pr_list}; do # building so we force and exit 0 instead to does not get relabled ################################################################# if [[ ${ci_status} -ne 0 ]]; then - pr_id_check=$("${HOMEgfs}/ci/scripts/pr_list_database.py" --display "{pr}" --dbfile "${pr_list_dbfile}" | awk '{print $4}') || true + pr_id_check=$("${ROOT_DIR}/ci/scripts/pr_list_database.py" --display "{pr}" --dbfile "${pr_list_dbfile}" | awk '{print $4}') || true if [[ "${pr_id}" -ne "${pr_id_check}" ]]; then exit 0 - fi + fi fi set -e if [[ ${ci_status} -eq 0 ]]; then - "${HOMEgfs}/ci/scripts/pr_list_database.py" --dbfile "${pr_list_dbfile}" --update_pr "${pr}" Open Built + "${ROOT_DIR}/ci/scripts/pr_list_database.py" --dbfile "${pr_list_dbfile}" --update_pr "${pr}" Open Built #setup space to put an experiment # export RUNTESTS for yaml case files to pickup export RUNTESTS="${pr_dir}/RUNTESTS" @@ -145,18 +144,17 @@ for pr in ${pr_list}; do # loop over every yaml file in the PR's ci/cases # and create an run directory for each one for this PR loop ############################################################# - HOMEgfs_PR="${pr_dir}/global-workflow" - export HOMEgfs_PR - cd "${HOMEgfs_PR}" + HOMEgfs="${pr_dir}/global-workflow" + cd "${HOMEgfs}" pr_sha=$(git rev-parse --short HEAD) - for yaml_config in "${HOMEgfs_PR}/ci/cases/pr/"*.yaml; do + for yaml_config in "${HOMEgfs}/ci/cases/pr/"*.yaml; do case=$(basename "${yaml_config}" .yaml) || true - pslot="${case}_${pr_sha}" + # export pslot for yaml case files to pickup + export pslot="${case}_${pr_sha}" rm -Rf "${STMP}/RUNDIRS/${pslot}" - export pslot set +e - "${HOMEgfs_PR}/ci/scripts/create_experiment.py" --yaml "${HOMEgfs_PR}/ci/cases/pr/${case}.yaml" --dir "${HOMEgfs_PR}" + "${HOMEgfs}/workflow/create_experiment.py" --yaml "${HOMEgfs}/ci/cases/pr/${case}.yaml" ci_status=$? set -e if [[ ${ci_status} -eq 0 ]]; then @@ -165,27 +163,27 @@ for pr in ${pr_list}; do echo "Case setup: Completed at $(date) for experiment ${pslot}" || true } >> "${GFS_CI_ROOT}/PR/${pr}/output_${id}" "${GH}" pr edit --repo "${REPO_URL}" "${pr}" --remove-label "CI-${MACHINE_ID^}-Building" --add-label "CI-${MACHINE_ID^}-Running" - "${HOMEgfs}/ci/scripts/pr_list_database.py" --dbfile "${pr_list_dbfile}" --update_pr "${pr}" Open Running - else + "${ROOT_DIR}/ci/scripts/pr_list_database.py" --dbfile "${pr_list_dbfile}" --update_pr "${pr}" Open Running + else { echo "Failed to create experiment: *FAIL* ${pslot}" echo "Experiment setup: failed at $(date) for experiment ${pslot}" || true echo "" - cat "${HOMEgfs_PR}/ci/scripts/"setup_*.std* + cat "${HOMEgfs}/ci/scripts/"setup_*.std* } >> "${GFS_CI_ROOT}/PR/${pr}/output_${id}" "${GH}" pr edit "${pr}" --repo "${REPO_URL}" --remove-label "CI-${MACHINE_ID^}-Building" --add-label "CI-${MACHINE_ID^}-Failed" - "${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}" fi done - else + else { echo '```' echo "Failed on cloning and building global-workflowi PR: ${pr}" echo "CI on ${MACHINE_ID^} failed to build on $(date) for repo ${REPO_URL}" || true } >> "${GFS_CI_ROOT}/PR/${pr}/output_${id}" "${GH}" pr edit "${pr}" --repo "${REPO_URL}" --remove-label "CI-${MACHINE_ID^}-Building" --add-label "CI-${MACHINE_ID^}-Failed" - "${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}" fi 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}" diff --git a/ci/scripts/driver_weekly.sh b/ci/scripts/driver_weekly.sh index 3650f75dfc..a52e5b1caa 100755 --- a/ci/scripts/driver_weekly.sh +++ b/ci/scripts/driver_weekly.sh @@ -8,13 +8,13 @@ set -eux # # Abstract: # -# This script runs the high resolution cases found in $HOMEgfs/ci/cases/weekly +# This script runs the high resolution cases found in ${HOMEgfs}/ci/cases/weekly # from the develop branch for the global-workflow repo that are intended to run on a weekly basis # from a cron job. When run it will clone and build a new branch from the EMC's global-workflow and # and create a pr using GitHub CLI by moving and replacing the yaml case files in # ${HOMEgfs}/ci/cases/weekly to {HOMEgfs}/ci/cases/pr. Then the requisite labels are added # so that the current BASH CI framework can then run these cases. Since this script -# creates a PR with the CI-Ready labels, the BASH CI framework will automatically run these cases +# creates a PR with the CI-Ready labels, the BASH CI framework will automatically run these cases # from that point so it is only required to run this script once from a single machine. ############################################################################################## @@ -27,7 +27,7 @@ export REPO_URL="ssh://git@ssh.github.com:443/NOAA-EMC/global-workflow.git" ################################################################ # Setup the relative paths to scripts and PS4 for better logging ################################################################ -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[0]})[${LINENO}]' @@ -36,11 +36,11 @@ export PS4='+ $(basename ${BASH_SOURCE[0]})[${LINENO}]' # Set up runtime environment variables for accounts on supported 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." @@ -52,8 +52,8 @@ esac # setup runtime env for correct python install and git ###################################################### 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}" set -x @@ -71,7 +71,7 @@ cd global-workflow || exit 1 git checkout -b "${branch}" ###################################################### -# move yaml files from ci/cases/weekly to ci/cases/pr +# move yaml files from ci/cases/weekly to ci/cases/pr # and push new branch for PR weekly CI tests to GitHub REPO_OWNER="emcbot" REPO_NAME="global-workflow" diff --git a/ci/scripts/run_ci.sh b/ci/scripts/run_ci.sh index 0ff3725be9..cdaafb337f 100755 --- a/ci/scripts/run_ci.sh +++ b/ci/scripts/run_ci.sh @@ -3,13 +3,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 # simply running rocotorun on each. This script is intended # to run from within a cron job in the CI Managers account # Abstract TODO ##################################################################################### -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}]' @@ -18,11 +18,11 @@ export PS4='+ $(basename ${BASH_SOURCE})[${LINENO}]' # 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." @@ -30,8 +30,8 @@ case ${MACHINE_ID} in ;; 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 -eux @@ -47,7 +47,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" --display --dbfile "${pr_list_dbfile}" | grep -v Failed | grep Open | grep Running | awk '{print $1}' | head -"${max_concurrent_pr}") || true + pr_list=$("${ROOT_DIR}/ci/scripts/pr_list_database.py" --display --dbfile "${pr_list_dbfile}" | grep -v Failed | grep Open | grep Running | awk '{print $1}' | head -"${max_concurrent_pr}") || true fi if [[ -z "${pr_list}" ]]; then echo "no open and built PRs that are ready for the cases to advance with rocotorun .. exiting" diff --git a/parm/config/gefs/config.base.emc.dyn b/parm/config/gefs/config.base.emc.dyn index 5f2d826b65..e3e221c006 100644 --- a/parm/config/gefs/config.base.emc.dyn +++ b/parm/config/gefs/config.base.emc.dyn @@ -137,7 +137,7 @@ export DO_WAVE="NO" export DO_OCN="NO" export DO_ICE="NO" export DO_AERO="NO" -export CCPP_SUITE="@CCPP_SUITE@" +export CCPP_SUITE="FV3_GFS_v17_p8" export WAVE_CDUMP="" # When to include wave suite: gdas, gfs, or both export DOBNDPNT_WAVE="NO" export cplwav2atm=".false." @@ -203,7 +203,7 @@ case "${APP}" in export DO_COUPLED="YES" export DO_OCN="YES" export DO_ICE="YES" - export CCPP_SUITE="FV3_GFS_v17_coupled_p8" + export CCPP_SUITE="FV3_GFS_v17_coupled_p8" # TODO: Does this include FV3_GFS_v17_p8? Can this be used instead of FV3_GFS_v17_p8 on L141 export confignamevarfornems="cpld" if [[ "${APP}" =~ A$ ]]; then @@ -263,7 +263,7 @@ export FLTFILEGFS="${PARMgfs}/post/postxconfig-NT-GEFS.txt" export FLTFILEGFSF00="${PARMgfs}/post/postxconfig-NT-GEFS-F00.txt" # Microphysics Options: 99-ZhaoCarr, 8-Thompson; 6-WSM6, 10-MG, 11-GFDL -export imp_physics=@IMP_PHYSICS@ +export imp_physics=8 # Shared parameters # DA engine diff --git a/parm/config/gfs/config.base.emc.dyn b/parm/config/gfs/config.base.emc.dyn index 06db406ddf..09d8897a31 100644 --- a/parm/config/gfs/config.base.emc.dyn +++ b/parm/config/gfs/config.base.emc.dyn @@ -145,14 +145,14 @@ export DO_WAVE="NO" export DO_OCN="NO" export DO_ICE="NO" export DO_AERO="NO" -export CCPP_SUITE="@CCPP_SUITE@" +export CCPP_SUITE="FV3_GFS_v17_p8" export WAVE_CDUMP="" # When to include wave suite: gdas, gfs, or both export DOBNDPNT_WAVE="NO" export cplwav2atm=".false." export FRAC_GRID=".true." # Set operational resolution -export OPS_RES="C768" # Do not change +export OPS_RES="C768" # Do not change # TODO: Why is this needed and where is it used? # Resolution specific parameters export LEVS=128 @@ -211,7 +211,7 @@ case "${APP}" in export DO_COUPLED="YES" export DO_OCN="YES" export DO_ICE="YES" - export CCPP_SUITE="FV3_GFS_v17_coupled_p8" + export CCPP_SUITE="FV3_GFS_v17_coupled_p8" # TODO: Does this include FV3_GFS_v17_p8? Can this be used instead of FV3_GFS_v17_p8 on L149 export confignamevarfornems="cpld" if [[ "${APP}" =~ A$ ]]; then @@ -283,7 +283,7 @@ export WRITE_DOPOST=".true." # WRITE_DOPOST=true, use inline POST export WRITE_NSFLIP=".true." # IAU related parameters -export DOIAU="YES" # Enable 4DIAU for control with 3 increments +export DOIAU="@DOIAU@" # Enable 4DIAU for control with 3 increments export IAUFHRS="3,6,9" export IAU_FHROT=${IAUFHRS%%,*} export IAU_DELTHRS=6 @@ -301,7 +301,7 @@ export lobsdiag_forenkf=".true." # fi # Microphysics Options: 99-ZhaoCarr, 8-Thompson; 6-WSM6, 10-MG, 11-GFDL -export imp_physics=@IMP_PHYSICS@ +export imp_physics=8 # Shared parameters # DA engine diff --git a/parm/config/gfs/config.ocnanal b/parm/config/gfs/config.ocnanal index 36519c7f35..ec45ddd288 100644 --- a/parm/config/gfs/config.ocnanal +++ b/parm/config/gfs/config.ocnanal @@ -5,17 +5,16 @@ echo "BEGIN: config.ocnanal" -export OBS_YAML_DIR=${HOMEgfs}/sorc/gdas.cd/parm/soca/obs/config +export OBS_YAML_DIR="${HOMEgfs}/sorc/gdas.cd/parm/soca/obs/config" export OBS_LIST=@SOCA_OBS_LIST@ -[[ -n "${OBS_LIST}" ]] || export OBS_LIST=${HOMEgfs}/sorc/gdas.cd/parm/soca/obs/obs_list.yaml -export OBS_YAML=${OBS_LIST} -export FV3JEDI_STAGE_YAML=${HOMEgfs}/sorc/gdas.cd/test/soca/testinput/dumy.yaml +export OBS_YAML="${OBS_LIST}" +export FV3JEDI_STAGE_YAML="${HOMEgfs}/sorc/gdas.cd/test/soca/testinput/dumy.yaml" export SOCA_INPUT_FIX_DIR=@SOCA_INPUT_FIX_DIR@ export SOCA_VARS=tocn,socn,ssh export SABER_BLOCKS_YAML=@SABER_BLOCKS_YAML@ export SOCA_NINNER=@SOCA_NINNER@ export CASE_ANL=@CASE_ANL@ -export DOMAIN_STACK_SIZE=116640000 #TODO: Make the stack size reolution dependent +export DOMAIN_STACK_SIZE=116640000 #TODO: Make the stack size resolution dependent export JEDI_BIN=${HOMEgfs}/sorc/gdas.cd/build/bin # R2D2 diff --git a/parm/config/gfs/yaml/defaults.yaml b/parm/config/gfs/yaml/defaults.yaml index 202efc2270..8c2b4ff22b 100644 --- a/parm/config/gfs/yaml/defaults.yaml +++ b/parm/config/gfs/yaml/defaults.yaml @@ -1,9 +1,11 @@ base: + DOIAU: "YES" DO_JEDIATMVAR: "NO" DO_JEDIATMENS: "NO" DO_JEDIOCNVAR: "NO" DO_JEDILANDDA: "NO" DO_MERGENSST: "NO" + aeroanl: IO_LAYOUT_X: 1 IO_LAYOUT_Y: 1 @@ -13,13 +15,13 @@ landanl: IO_LAYOUT_Y: 1 ocnanal: - SOCA_INPUT_FIX_DIR: '/scratch2/NCEPDEV/ocean/Guillaume.Vernieres/data/static/72x35x25' - CASE_ANL: 'C48' - SOCA_OBS_LIST: '' - COMIN_OBS: '/scratch2/NCEPDEV/marineda/r2d2' - SABER_BLOCKS_YAML: '' - SOCA_NINNER: 50 - R2D2_OBS_SRC: 'gdas_marine' - R2D2_OBS_DUMP: 's2s_v1' + SOCA_INPUT_FIX_DIR: "/scratch2/NCEPDEV/ocean/Guillaume.Vernieres/data/static/72x35x25/soca" # TODO: These need to go to glopara fix space. @guillaumevernieres will open an issue + CASE_ANL: "C48" + COMIN_OBS: "/scratch2/NCEPDEV/marineda/r2d2-v2-v3" # TODO: make platform agnostic + SOCA_OBS_LIST: "{{ HOMEgfs }}/sorc/gdas.cd/parm/soca/obs/obs_list.yaml" + SOCA_NINNER: 100 + R2D2_OBS_SRC: "gdas_marine" + R2D2_OBS_DUMP: "s2s_v1" + SABER_BLOCKS_YAML: "" NICAS_RESOL: 1 NICAS_GRID_SIZE: 15000 diff --git a/ci/scripts/create_experiment.py b/workflow/create_experiment.py similarity index 62% rename from ci/scripts/create_experiment.py rename to workflow/create_experiment.py index 3c5096e875..c343f1d798 100755 --- a/ci/scripts/create_experiment.py +++ b/workflow/create_experiment.py @@ -3,7 +3,7 @@ """ Basic python script to create an experiment directory on the fly from a given yaml file for the arguments to the two scripts below in ${HOMEgfs}/workflow -where ${HOMEgfs} is specified within the input yaml file. +where ${HOMEgfs} is determined from the location of this script. ${HOMEgfs}/workflow/setup_expt.py ${HOMEgfs}/workflow/setup_xml.py @@ -18,22 +18,21 @@ """ import os -import sys + from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter from pathlib import Path -from wxflow import YAMLFile, Logger, logit +from wxflow import AttrDict, parse_j2yaml, Logger, logit + +import setup_expt +import setup_xml _here = os.path.dirname(__file__) -_top = os.path.abspath(os.path.join(os.path.abspath(_here), '../..')) -logger = Logger(level='DEBUG', colored_log=True) +_top = os.path.abspath(os.path.join(os.path.abspath(_here), '..')) - -# TODO: move create_experiment.py to workflow/ and remove this sys.path.insert business -sys.path.insert(0, os.path.join(_top, 'workflow')) -import setup_expt -import setup_xml +# Setup the logger +logger = Logger(level=os.environ.get("LOGGING_LEVEL", "INFO"), colored_log=True) @logit(logger) @@ -61,8 +60,8 @@ def input_args(): parser = ArgumentParser(description=description, formatter_class=ArgumentDefaultsHelpFormatter) - parser.add_argument('--yaml', help='full path to yaml file describing the experiment configuration', type=str, required=True) - parser.add_argument('--dir', help='full path to global-workflow build', type=str, required=True) + parser.add_argument( + '--yaml', help='full path to yaml file describing the experiment configuration', type=Path, required=True) return parser.parse_args() @@ -70,21 +69,28 @@ def input_args(): if __name__ == '__main__': user_inputs = input_args() - HOMEgfs = Path.absolute(Path(user_inputs.dir)) - testconf = YAMLFile(path=user_inputs.yaml) - experiment_dir = Path.absolute(Path.joinpath(Path(testconf.arguments.expdir), Path(testconf.arguments.pslot))) + + # Create a dictionary to pass to parse_j2yaml for parsing the yaml file + data = AttrDict(HOMEgfs=_top) + data.update(os.environ) + testconf = parse_j2yaml(path=user_inputs.yaml, data=data) # Create a list of arguments to setup_expt.py - setup_expt_args = [testconf.experiment.type, testconf.experiment.mode] # TODO: rename 'type' as 'system' in case.yaml + setup_expt_args = [testconf.experiment.system, testconf.experiment.mode] for kk, vv in testconf.arguments.items(): setup_expt_args.append(f"--{kk}") setup_expt_args.append(str(vv)) - logger.info(f'Call: setup_expt.main()') + logger.info(f"Call: setup_expt.main()") + logger.debug(f"setup_expt.py {' '.join(setup_expt_args)}") setup_expt.main(setup_expt_args) # Create a list of arguments to setup_xml.py + experiment_dir = Path.absolute(Path.joinpath( + Path(testconf.arguments.expdir), Path(testconf.arguments.pslot))) + setup_xml_args = [str(experiment_dir)] logger.info(f"Call: setup_xml.main()") + logger.debug(f"setup_xml.py {' '.join(setup_xml_args)}") setup_xml.main(setup_xml_args) diff --git a/workflow/setup_expt.py b/workflow/setup_expt.py index c9aa9188f6..a9810ec3f2 100755 --- a/workflow/setup_expt.py +++ b/workflow/setup_expt.py @@ -343,10 +343,6 @@ def edit_baseconfig(host, inputs, yaml_dict): } tmpl_dict = dict(tmpl_dict, **extend_dict) - # All apps and modes now use the same physics and CCPP suite by default - extend_dict = {"@CCPP_SUITE@": "FV3_GFS_v17_p8", "@IMP_PHYSICS@": 8} - tmpl_dict = dict(tmpl_dict, **extend_dict) - try: tmpl_dict = dict(tmpl_dict, **get_template_dict(yaml_dict['base'])) except KeyError: