-
Notifications
You must be signed in to change notification settings - Fork 215
Add CI cron jobs #1476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CI cron jobs #1476
Changes from 117 commits
a2faebc
37b0c15
37cfedb
349a383
f111c47
619bdce
28a509b
efd04aa
b7df0e7
e2c211d
07c81e7
7cca618
b0fcb3d
801bbf3
e76d66a
def8455
b067ed6
7343b27
393d570
c2cb34d
b7e51db
96d8498
b905ef3
4abb87f
1d75a06
2eee604
72a4bfd
a3324a6
88a9185
4fa9e3a
888a400
3ecca64
3882cac
227dad8
a26d4af
5f3535f
bf3f5cc
2f9b0a5
2f72f48
dd81b6e
2773f09
44226f2
e127ed2
ce362ea
eb7471b
ec71918
1bc444f
2ee5051
522aa27
59c3226
06f902e
aadb132
909a31b
cb0ed72
7333130
adf6809
1da08ab
8486d1d
0a83799
8698f71
ee50f86
b0ad92c
535721f
aae6072
2fc7b44
126d435
74415b3
a71a916
a3f05bb
6d421e4
c0287ba
8009fb2
94f8c8a
e6ffad4
5080370
0b8f38d
3e4e921
22a9073
8f04d79
6889ee9
856bb2b
bb34e9c
f990c9c
86d6104
530882a
969877b
dffadd3
aa21ef7
e68fa99
51a55d4
5818dcb
1f27cd9
e9036cf
c0ad448
8afa313
5bec286
16a82f6
51700d4
482fc31
c1d677f
e850d6d
32396e7
54e9ebe
3d0c07b
a51661c
9865a74
3404bff
3e7a9af
2d36572
9851300
cdc57ce
07ddb49
737483f
8c6d13d
a64d1ab
0423bb9
e6f4550
daebe97
4b7a73a
458c5ea
dc87c92
0779ff6
0140a17
ff73987
c183221
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| experiment: | ||
| mode: cycled | ||
|
|
||
| arguments: | ||
| app: ATM | ||
| resdet: 96 | ||
| resens: 48 | ||
| comrot: ${RUNTESTS}/${pslot}/COMROT | ||
| expdir: ${RUNTESTS}/${pslot}/EXPDIR | ||
| icsdir: ${ICSDIR_ROOT}/C96C48 | ||
| idate: 2021122018 | ||
| edate: 2021122200 | ||
| nens: 2 | ||
| gfs_cyc: 1 | ||
| start: cold |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| experiment: | ||
| mode: cycled | ||
|
|
||
| arguments: | ||
| app: ATM | ||
| resdet: 96 | ||
| comrot: ${RUNTESTS}/${pslot}/COMROT | ||
| expdir: ${RUNTESTS}/${pslot}/EXPDIR | ||
| icsdir: ${ICSDIR_ROOT}/C96C48 | ||
| idate: 2021122018 | ||
| edate: 2021122100 | ||
| nens: 0 | ||
| gfs_cyc: 1 | ||
| start: cold |
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,7 @@ | ||
| #!/usr/bin/bash | ||
| export GFS_CI_ROOT=/scratch1/NCEPDEV/global/Terry.McGuinness/GFS_CI_ROOT | ||
| export GFS_MODULE_USE="${GFS_CI_ROOT}/global-workflow/modulefiles" | ||
| export SLURM_ACCOUNT=fv3-cpu | ||
| export SALLOC_ACCOUNT="${SLURM_ACCOUNT}" | ||
| export SBATCH_ACCOUNT="${SLURM_ACCOUNT}" | ||
| export SLURM_QOS=debug | ||
| export repo_url="https://github.com/NOAA-EMC/global-workflow.git" | ||
| #export repo_url="https://github.com/TerrenceMcGuinness-NOAA/global-workflow.git" | ||
| export ICSDIR_ROOT="/scratch1/NCEPDEV/global/glopara/data/ICSDIR" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| #!/bin/bash | ||
| set -aux | ||
| ##################################################################################### | ||
| # | ||
| # 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 | ||
| # Abstract TODO | ||
| ##################################################################################### | ||
|
|
||
| HOMEgfs="$(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}]' | ||
|
|
||
| GH=${HOME}/bin/gh | ||
| REPO_URL=${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" | ||
| case ${MACHINE_ID} in | ||
| hera | orion) | ||
| echo "Running Automated Testing on ${MACHINE_ID}" | ||
| source "${HOMEgfs}/ci/platforms/${MACHINE_ID}.sh" | ||
| ;; | ||
| *) | ||
| echo "Unsupported platform. Exiting with error." | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| set +x | ||
| source "${HOMEgfs}/ush/module-setup.sh" | ||
| module use "${HOMEgfs}/modulefiles" | ||
| module load "module_gwsetup.${MACHINE_ID}" | ||
| module list | ||
| set -x | ||
| rocotostat=$(which rocotostat) | ||
| if [[ -z ${rocotostat+x} ]]; then | ||
| echo "rocotostat not found on system" | ||
| exit 1 | ||
| else | ||
| echo "rocotostat being used from ${rocotostat}" | ||
| fi | ||
|
|
||
| pr_list_file="open_pr_list" | ||
|
|
||
| if [[ -s "${GFS_CI_ROOT}/${pr_list_file}" ]]; then | ||
| pr_list=$(cat "${GFS_CI_ROOT}/${pr_list_file}") | ||
| else | ||
| echo "no PRs to process .. exit" | ||
| exit 0 | ||
| fi | ||
|
|
||
| ############################################################# | ||
| # Loop throu all PRs in PR List and look for expirments in | ||
| # the RUNTESTS dir and for each one run runcotorun on them | ||
| ############################################################# | ||
|
|
||
| for pr in ${pr_list}; do | ||
| id=$("${GH}" pr view "${pr}" --repo "${REPO_URL}" --json id --jq '.id') | ||
| echo "Processing Pull Request #${pr} and looking for cases" | ||
| pr_dir="${GFS_CI_ROOT}/PR/${pr}" | ||
| num_cases=$(find "${pr_dir}/RUNTESTS" -mindepth 1 -maxdepth 1 -type d | wc -l) || true | ||
| for cases in "${pr_dir}/RUNTESTS/"*; do | ||
| pslot=$(basename "${cases}") | ||
| xml="${pr_dir}/RUNTESTS/${pslot}/EXPDIR/${pslot}/${pslot}.xml" | ||
| db="${pr_dir}/RUNTESTS/${pslot}/EXPDIR/${pslot}/${pslot}.db" | ||
| rocoto_stat_output=$("${rocotostat}" -w "${xml}" -d "${db}" -s | grep -v CYCLE) || true | ||
| num_cycles=$(echo "${rocoto_stat_output}" | wc -l) || true | ||
| num_done=$(echo "${rocoto_stat_output}" | grep -c Done) || true | ||
| num_succeeded=$("${rocotostat}" -w "${xml}" -d "${db}" -a | grep -c SUCCEEDED) || true | ||
| echo "${pslot} Total Cycles: ${num_cycles} number done: ${num_done}" || true | ||
| num_failed=$("${rocotostat}" -w "${xml}" -d "${db}" -a | grep -c -E 'FAIL|DEAD') || true | ||
| if [[ ${num_failed} -ne 0 ]]; then | ||
| { | ||
| echo "Experiment ${pslot} Terminated: *FAILED*" | ||
| echo "Experiment ${pslot} Terminated with ${num_failed} tasks failed at $(date)" || true | ||
| } >> "${GFS_CI_ROOT}/PR/${pr}/output_${id}" | ||
| "${GH}" pr edit --repo "${REPO_URL}" "${pr}" --remove-label "CI-${MACHINE_ID^}-Running" --add-label "CI-${MACHINE_ID^}-Failed" | ||
| "${GH}" pr comment "${pr}" --repo "${REPO_URL}" --body-file "${GFS_CI_ROOT}/PR/${pr}/output_${id}" | ||
| sed -i "/${pr}/d" "${GFS_CI_ROOT}/${pr_list_file}" | ||
| fi | ||
| if [[ "${num_done}" -eq "${num_cycles}" ]]; then | ||
| { | ||
| echo "Experiment ${pslot} completed: *SUCCESS*" | ||
| echo "Experiment ${pslot} Completed at $(date)" || true | ||
| echo -n "with ${num_succeeded} successfully completed jobs" || true | ||
| } >> "${GFS_CI_ROOT}/PR/${pr}/output_${id}" | ||
| "${GH}" pr comment "${pr}" --repo "${REPO_URL}" --body-file "${GFS_CI_ROOT}/PR/${pr}/output_${id}" | ||
| #Remove Experment cases that completed successfully | ||
| rm -Rf "${pr_dir}/RUNTESTS/${pslot}" | ||
| fi | ||
| done | ||
| #Check passes PR when ${pr_dir}/RUNTESTS is void of subfolders since all successfull ones where previously removed | ||
| if [[ "${num_cases}" -eq 0 ]] && [[ -d "${pr_dir}/RUNTESTS" ]]; then | ||
| "${GH}" pr edit --repo "${REPO_URL}" "${pr}" --remove-label "CI-${MACHINE_ID^}-Running" --add-label "CI-${MACHINE_ID^}-Passed" | ||
| sed -i "/${pr}/d" "${GFS_CI_ROOT}/${pr_list_file}" | ||
| fi | ||
| done | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,6 @@ | ||
| #!/bin/bash | ||
| set -eux | ||
|
|
||
| ################################################################# | ||
| # TODO using static build for GitHub CLI until fixed in HPC-Stack | ||
| ################################################################# | ||
| GH=/home/Terry.McGuinness/bin/gh | ||
| repo_url=${repo_url:-"https://github.com/global-workflow.git"} | ||
| ##################################################################### | ||
| # Usage and arguments for specfifying cloned directgory | ||
| ##################################################################### | ||
|
|
@@ -45,25 +40,14 @@ while getopts "p:d:o:h" opt; do | |
| esac | ||
| done | ||
|
|
||
| #################################################################### | ||
| # start output file | ||
| { | ||
| echo "Automated global-workflow Testing Results:" | ||
| echo "Machine: ${CI_HOST}" | ||
| echo '```' | ||
| echo "Start: $(date) on $(hostname)" || true | ||
| echo "---------------------------------------------------" | ||
| } >> "${outfile}" | ||
| ###################################################################### | ||
|
|
||
| cd "${repodir}" | ||
| cd "${repodir}" || exit | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be a non-zero exit
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was marked as resolved but not actually resolved.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I double checked in my branch at it was but not here. Let me do that again and see why.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah it has been updated. It is just not being reflected here in the chat stream. Follow this link.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, there it is. I think going back to my repo and syncing it to the main repo updated these changes upstream.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still no exit code.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line 50 has had that |
||
| # clone copy of repo | ||
| if [[ -d global-workflow ]]; then | ||
| rm -Rf global-workflow | ||
| fi | ||
|
|
||
| git clone "${repo_url}" | ||
| cd global-workflow | ||
| git clone "${REPO_URL}" | ||
| cd global-workflow || exit 1 | ||
|
|
||
| pr_state=$(gh pr view "${PR}" --json state --jq '.state') | ||
| if [[ "${pr_state}" != "OPEN" ]]; then | ||
|
|
@@ -73,34 +57,63 @@ if [[ "${pr_state}" != "OPEN" ]]; then | |
| fi | ||
|
|
||
| # checkout pull request | ||
| "${GH}" pr checkout "${PR}" --repo "${repo_url}" | ||
| "${GH}" pr checkout "${PR}" --repo "${REPO_URL}" | ||
| HOMEgfs="${PWD}" | ||
| source "${HOMEgfs}/ush/detect_machine.sh" | ||
|
|
||
| #################################################################### | ||
| # start output file | ||
| { | ||
| echo "Automated global-workflow Testing Results:" | ||
| echo '```' | ||
| echo "Machine: ${MACHINE_ID^}" | ||
| echo "Start: $(date) on $(hostname)" || true | ||
| echo "---------------------------------------------------" | ||
| } >> "${outfile}" | ||
| ###################################################################### | ||
|
|
||
| # get commit hash | ||
| commit=$(git log --pretty=format:'%h' -n 1) | ||
| echo "${commit}" > "../commit" | ||
|
|
||
| # run build script | ||
| cd sorc | ||
| # run checkout script | ||
| cd sorc || exit 1 | ||
| set +e | ||
| ./checkout.sh -c -g -u &>> log.checkout | ||
| checkout_status=$? | ||
| if [[ ${checkout_status} != 0 ]]; then | ||
| { | ||
| echo "Checkout: *FAILED*" | ||
| echo "Checkout: Failed at $(date)" || true | ||
| echo "Checkout: see output at ${PWD}/log.checkout" | ||
| } >> "${outfile}" | ||
| exit "${checkout_status}" | ||
| else | ||
| { | ||
| echo "Checkout: *SUCCESS*" | ||
| echo "Checkout: Completed at $(date)" || true | ||
| } >> "${outfile}" | ||
| fi | ||
|
|
||
| # build full cycle | ||
| source "${HOMEgfs}/ush/module-setup.sh" | ||
| export BUILD_JOBS=8 | ||
| rm -rf log.build | ||
| ./checkout.sh -g -c | ||
| # build full cycle | ||
| ./build_all.sh -g &>> log.build | ||
|
|
||
| # Validations | ||
| ./build_all.sh &>> log.build | ||
| build_status=$? | ||
| if [[ ${build_status} -eq 0 ]]; then | ||
| { | ||
| echo "Build: *SUCCESS*" | ||
| echo "Build: Completed at $(date)" || true | ||
| } >> "${outfile}" | ||
|
|
||
| if [[ ${build_status} != 0 ]]; then | ||
| { | ||
| echo "Build: *FAILED*" | ||
| echo "Build: Failed at $(date)" || true | ||
| echo "Build: see output at ${PWD}/log.build" | ||
| } >> "${outfile}" | ||
| exit "${build_status}" | ||
| else | ||
| { | ||
| echo "Build: *FAILED*" | ||
| echo "Build: Failed at $(date)" || true | ||
| echo "Build: see output at ${PWD}/log.build" | ||
| } | ||
| echo '```' >> "${outfile}" | ||
| { | ||
| echo "Build: *SUCCESS*" | ||
| echo "Build: Completed at $(date)" || true | ||
| } >> "${outfile}" | ||
| fi | ||
|
|
||
| ./link_workflow.sh | ||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.