Skip to content

Commit 9e1d951

Browse files
Merge branch 'develop' into feature/jdas_enkf_diag_com_in_out
2 parents 2f28a71 + 00f567c commit 9e1d951

File tree

9 files changed

+139
-47
lines changed

9 files changed

+139
-47
lines changed
Lines changed: 68 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
name: gw-ci-aws-centos
2-
3-
on: [workflow_dispatch]
4-
1+
name: gw-ci-aws
52
# TEST_DIR contains 2 directories;
63
# 1. HOMEgfs: clone of the global-workflow
74
# 2. RUNTESTS: A directory containing EXPDIR and COMROT for experiments
@@ -10,33 +7,73 @@ on: [workflow_dispatch]
107
# ├── HOMEgfs
118
# └── RUNTESTS
129
# ├── COMROT
13-
#   └── ${pslot}
10+
# └── ${pslot}
1411
# └── EXPDIR
1512
# └── ${pslot}
13+
14+
on:
15+
workflow_dispatch:
16+
inputs:
17+
pr_number:
18+
description: 'Pull Request Number (use 0 for non-PR)'
19+
required: true
20+
default: '0'
21+
os:
22+
description: 'Operating System'
23+
required: true
24+
type: choice
25+
options:
26+
- rocky
27+
- centos
28+
1629
env:
1730
TEST_DIR: ${{ github.workspace }}/${{ github.run_id }}
1831
MACHINE_ID: noaacloud
1932

2033
jobs:
34+
fetch-branch:
35+
runs-on: ubuntu-latest
36+
env:
37+
GH_TOKEN: ${{ secrets.GITHUBTOKEN }}
38+
outputs:
39+
branch: ${{ steps.get-branch.outputs.branch }}
40+
steps:
41+
- name: Fetch branch name for PR
42+
id: get-branch
43+
run: |
44+
pr_number=${{ github.event.inputs.pr_number }}
45+
repo=${{ github.repository }}
46+
if [ "$pr_number" -eq "0" ]; then
47+
branch=${{ github.event.inputs.ref }}
48+
else
49+
branch=$(gh pr view $pr_number --repo $repo --json headRefName --jq '.headRefName')
50+
fi
51+
echo "::set-output name=branch::$branch"
52+
2153
checkout:
22-
runs-on: [self-hosted, aws, parallelworks, centos]
54+
needs: fetch-branch
55+
runs-on:
56+
- self-hosted
57+
- aws
58+
- parallelworks
59+
- ${{ github.event.inputs.os }}
2360
timeout-minutes: 600
24-
2561
steps:
26-
2762
- name: Checkout global-workflow
2863
uses: actions/checkout@v4
2964
with:
3065
path: ${{ github.run_id }}/HOMEgfs
3166
submodules: 'recursive'
32-
ref: ${{ github.event.pull_request.head.ref }}
67+
ref: ${{ needs.fetch-branch.outputs.branch }}
3368

3469
build-link:
35-
runs-on: [self-hosted, aws, parallelworks, centos]
3670
needs: checkout
37-
71+
runs-on:
72+
- self-hosted
73+
- aws
74+
- parallelworks
75+
- ${{ github.event.inputs.os }}
3876
steps:
39-
4077
- name: Build components
4178
run: |
4279
cd ${{ env.TEST_DIR }}/HOMEgfs/sorc
@@ -48,12 +85,15 @@ jobs:
4885
./link_workflow.sh
4986
5087
create-experiments:
51-
needs: checkout
52-
runs-on: [self-hosted, aws, parallelworks, centos]
88+
needs: build-link
89+
runs-on:
90+
- self-hosted
91+
- aws
92+
- parallelworks
93+
- ${{ github.event.inputs.os }}
5394
strategy:
5495
matrix:
5596
case: ["C48_ATM"]
56-
5797
steps:
5898
- name: Create Experiments ${{ matrix.case }}
5999
env:
@@ -68,9 +108,12 @@ jobs:
68108
69109
run-experiments:
70110
needs: create-experiments
71-
runs-on: [self-hosted, aws, parallelworks, centos]
111+
runs-on:
112+
- self-hosted
113+
- aws
114+
- parallelworks
115+
- ${{ github.event.inputs.os }}
72116
strategy:
73-
max-parallel: 2
74117
matrix:
75118
case: ["C48_ATM"]
76119
steps:
@@ -81,9 +124,13 @@ jobs:
81124
82125
clean-up:
83126
needs: run-experiments
84-
runs-on: [self-hosted, aws, parallelworks, centos]
127+
runs-on:
128+
- self-hosted
129+
- aws
130+
- parallelworks
131+
- ${{ github.event.inputs.os }}
85132
steps:
86-
- name: Clean-up
133+
- name: Clean up workspace
87134
run: |
88-
cd ${{ github.workspace }}
89-
rm -rf ${{ github.run_id }}
135+
echo "Cleaning up workspace"
136+
rm -rf ${{ env.TEST_DIR }}

ci/Jenkinsfile

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ def cases = ''
55
def GH = 'none'
66
// Location of the custom workspaces for each machine in the CI system. They are persitent for each iteration of the PR.
77
def NodeName = [hera: 'Hera-EMC', orion: 'Orion-EMC', hercules: 'Hercules-EMC', gaea: 'Gaea']
8-
def custom_workspace = [hera: '/scratch1/NCEPDEV/global/CI', orion: '/work2/noaa/stmp/CI/ORION', hercules: '/work2/noaa/stmp/CI/HERCULES', gaea: '/gpfs/f5/epic/proj-shared/global/CI']
8+
def custom_workspace = [hera: '/scratch1/NCEPDEV/global/CI', orion: '/work2/noaa/stmp/CI/ORION', hercules: '/work2/noaa/global/CI/HERCULES', gaea: '/gpfs/f5/epic/proj-shared/global/CI']
99
def repo_url = 'git@github.com:NOAA-EMC/global-workflow.git'
1010
def STATUS = 'Passed'
1111

@@ -101,9 +101,10 @@ pipeline {
101101
stages {
102102
stage('Building') {
103103
steps {
104-
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
104+
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
105105
script {
106106
def HOMEgfs = "${CUSTOM_WORKSPACE}/${system}" // local HOMEgfs is used to build the system on per system basis under the custome workspace for each buile system
107+
env.HOME_GFS = HOMEgfs // setting path in HOMEgfs as an environment variable HOME_GFS for some systems that using the path in its .bashrc
107108
sh(script: "mkdir -p ${HOMEgfs}")
108109
ws(HOMEgfs) {
109110
if (fileExists("${HOMEgfs}/sorc/BUILT_semaphor")) { // if the system is already built, skip the build in the case of re-runs
@@ -172,9 +173,10 @@ pipeline {
172173
}
173174
if (system == 'gfs') {
174175
cases = sh(script: "${HOMEgfs}/ci/scripts/utils/get_host_case_list.py ${machine}", returnStdout: true).trim().split()
176+
echo "Cases to run: ${cases}"
175177
}
176178
}
177-
}
179+
}
178180
}
179181
}
180182
}
@@ -192,32 +194,34 @@ pipeline {
192194
def parallelStages = cases.collectEntries { caseName ->
193195
["${caseName}": {
194196
stage("Create ${caseName}") {
195-
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
196-
script {
197-
sh(script: "sed -n '/{.*}/!p' ${CUSTOM_WORKSPACE}/gfs/ci/cases/pr/${caseName}.yaml > ${CUSTOM_WORKSPACE}/gfs/ci/cases/pr/${caseName}.yaml.tmp")
198-
def yaml_case = readYaml file: "${CUSTOM_WORKSPACE}/gfs/ci/cases/pr/${caseName}.yaml.tmp"
199-
system = yaml_case.experiment.system
200-
def HOMEgfs = "${CUSTOM_WORKSPACE}/${system}" // local HOMEgfs is used to populate the XML on per system basis
201-
env.RUNTESTS = "${CUSTOM_WORKSPACE}/RUNTESTS"
202-
try {
203-
error_output = sh(script: "${HOMEgfs}/ci/scripts/utils/ci_utils_wrapper.sh create_experiment ${HOMEgfs}/ci/cases/pr/${caseName}.yaml", returnStdout: true).trim()
204-
} catch (Exception error_create) {
205-
sh(script: """${GH} pr comment ${env.CHANGE_ID} --repo ${repo_url} --body "${Case} **FAILED** to create experment on ${Machine} in BUILD# ${env.BUILD_NUMBER}\n with the error:\n\\`\\`\\`\n${error_output}\\`\\`\\`" """)
206-
error("Case ${caseName} failed to create experment directory")
207-
}
197+
script {
198+
sh(script: "sed -n '/{.*}/!p' ${CUSTOM_WORKSPACE}/gfs/ci/cases/pr/${caseName}.yaml > ${CUSTOM_WORKSPACE}/gfs/ci/cases/pr/${caseName}.yaml.tmp")
199+
def yaml_case = readYaml file: "${CUSTOM_WORKSPACE}/gfs/ci/cases/pr/${caseName}.yaml.tmp"
200+
def build_system = yaml_case.experiment.system
201+
def HOMEgfs = "${CUSTOM_WORKSPACE}/${build_system}" // local HOMEgfs is used to populate the XML on per system basis
202+
env.HOME_GFS = HOMEgfs // setting path in HOMEgfs as an environment variable HOME_GFS for some systems that using the path in its .bashrc
203+
env.RUNTESTS = "${CUSTOM_WORKSPACE}/RUNTESTS"
204+
try {
205+
error_output = sh(script: "${HOMEgfs}/ci/scripts/utils/ci_utils_wrapper.sh create_experiment ${HOMEgfs}/ci/cases/pr/${caseName}.yaml", returnStdout: true).trim()
206+
} catch (Exception error_create) {
207+
sh(script: """${GH} pr comment ${env.CHANGE_ID} --repo ${repo_url} --body "${Case} **FAILED** to create experment on ${Machine} in BUILD# ${env.BUILD_NUMBER}\n with the error:\n\\`\\`\\`\n${error_output}\\`\\`\\`" """)
208+
error("Case ${caseName} failed to create experment directory")
208209
}
209-
}
210+
}
210211
}
211212

212213
stage("Running ${caseName}") {
213214
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
214215
script {
215216
HOMEgfs = "${CUSTOM_WORKSPACE}/gfs" // common HOMEgfs is used to launch the scripts that run the experiments
217+
env.HOME_GFS = HOMEgfs // setting path in HOMEgfs as an environment variable HOME_GFS for some systems that using the path in its .bashrc
216218
def pslot = sh(script: "${HOMEgfs}/ci/scripts/utils/ci_utils_wrapper.sh get_pslot ${CUSTOM_WORKSPACE}/RUNTESTS ${caseName}", returnStdout: true).trim()
217219
def error_file = "${CUSTOM_WORKSPACE}/RUNTESTS/${pslot}_error.logs"
218220
sh(script: " rm -f ${error_file}")
221+
def yaml_case = readYaml file: "${CUSTOM_WORKSPACE}/gfs/ci/cases/pr/${caseName}.yaml.tmp"
222+
def build_system = yaml_case.experiment.system
219223
try {
220-
sh(script: "${HOMEgfs}/ci/scripts/run-check_ci.sh ${CUSTOM_WORKSPACE} ${pslot} ${system}")
224+
sh(script: "${HOMEgfs}/ci/scripts/run-check_ci.sh ${CUSTOM_WORKSPACE} ${pslot} ${build_system}")
221225
} catch (Exception error_experment) {
222226
sh(script: "${HOMEgfs}/ci/scripts/utils/ci_utils_wrapper.sh cancel_batch_jobs ${pslot}")
223227
ws(CUSTOM_WORKSPACE) {
@@ -268,11 +272,11 @@ pipeline {
268272
}
269273
}
270274

271-
272275
stage( '5. FINALIZE' ) {
273276
agent { label NodeName[machine].toLowerCase() }
274277
steps {
275278
script {
279+
env.HOME_GFS = "${CUSTOM_WORKSPACE}/gfs" // setting path to HOMEgfs as an environment variable HOME_GFS for some systems that using the path in its .bashrc
276280
sh(script: """
277281
labels=\$(${GH} pr view ${env.CHANGE_ID} --repo ${repo_url} --json labels --jq '.labels[].name')
278282
for label in \$labels; do

ci/cases/pr/C96C48_hybatmaerosnowDA.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ arguments:
1818
yaml: {{ HOMEgfs }}/ci/cases/yamls/atmaerosnowDA_defaults_ci.yaml
1919

2020
skip_ci_on_hosts:
21+
- wcoss2
2122
- orion
2223
- gaea
2324
- hercules

ci/scripts/utils/launch_java_agent.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export GH="${HOME}/bin/gh"
106106
[[ -f "${GH}" ]] || echo "gh is not installed in ${HOME}/bin"
107107
${GH} --version
108108

109-
check_mark=$(gh auth status -t 2>&1 | grep "Token:" | awk '{print $1}') || true
109+
check_mark=$("${GH}" auth status -t 2>&1 | grep "Token:" | awk '{print $1}') || true
110110
if [[ "${check_mark}" != "" ]]; then
111111
echo "gh not authenticating with emcbot token"
112112
exit 1

sorc/gdas.cd

Submodule gdas.cd updated 107 files

ush/python/pygfs/task/marine_analysis.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ def _prep_variational_yaml(self: Task) -> None:
210210
envconfig_jcb['cyc'] = os.getenv('cyc')
211211
envconfig_jcb['SOCA_NINNER'] = self.task_config.SOCA_NINNER
212212
envconfig_jcb['obs_list'] = ['adt_rads_all']
213+
envconfig_jcb['MOM6_LEVS'] = mdau.get_mom6_levels(str(self.task_config.OCNRES))
213214

214215
# Write obs_list_short
215216
save_as_yaml(parse_obs_list_file(self.task_config.MARINE_OBS_LIST_YAML), 'obs_list_short.yaml')

ush/python/pygfs/utils/marine_da_utils.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,36 @@ def clean_empty_obsspaces(config, target, app='var'):
166166

167167
# save cleaned yaml
168168
save_as_yaml(config, target)
169+
170+
171+
@logit(logger)
172+
def get_mom6_levels(ocnres: str) -> int:
173+
"""
174+
Temporary function that returns the number of vertical levels in MOM6 given the horizontal resolution.
175+
This is requiered by the diffusion saber block that now makes use of oops::util::FieldSetHelpers::writeFieldSet
176+
and requires the number of levels in the configuration. I have been told this will be changed in the future.
177+
178+
Parameters
179+
-----------
180+
ocnres: str
181+
Input resolution for ocean in str format. e.g. '500', '100', '050', '025'
182+
183+
Returns
184+
-------
185+
nlev: int
186+
number of levels in the ocean model given an input resolution
187+
"""
188+
189+
# Currently implemented resolutions
190+
ocnres_to_nlev = {
191+
'500': 25,
192+
'100': 75,
193+
'050': 75,
194+
'025': 75
195+
}
196+
try:
197+
nlev = ocnres_to_nlev.get(ocnres)
198+
except KeyError:
199+
raise KeyError("FATAL ERROR: Invalid ocnres value. Aborting.")
200+
201+
return nlev

versions/fix.ver

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export cice_ver=20240416
88
export cpl_ver=20230526
99
export datm_ver=20220805
1010
export gdas_crtm_ver=20220805
11-
export gdas_fv3jedi_ver=20220805
11+
export gdas_fv3jedi_ver=20241022
1212
export gdas_soca_ver=20240802
1313
export gdas_gsibec_ver=20240416
1414
export gdas_obs_ver=20240213

workflow/generate_workflows.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ function _usage() {
7171
If this option is not specified, then the existing email address in
7272
the crontab will be preserved.
7373
74+
-t Add a 'tag' to the end of the case names in the pslots to distinguish
75+
pslots between multiple sets of tests.
76+
7477
-v Verbose mode. Prints output of all commands to stdout.
7578
7679
-V Very verbose mode. Passes -v to all commands and prints to stdout.
@@ -101,6 +104,7 @@ _hpc_account=""
101104
_set_account=false
102105
_update_cron=false
103106
_email=""
107+
_tag=""
104108
_set_email=false
105109
_verbose=false
106110
_very_verbose=false
@@ -111,7 +115,7 @@ _runtests="${RUNTESTS:-${_runtests:-}}"
111115
_nonflag_option_count=0
112116

113117
while [[ $# -gt 0 && "$1" != "--" ]]; do
114-
while getopts ":H:bB:uy:Y:GESA:ce:vVdh" option; do
118+
while getopts ":H:bB:uy:Y:GESA:ce:t:vVdh" option; do
115119
case "${option}" in
116120
H)
117121
HOMEgfs="${OPTARG}"
@@ -138,6 +142,7 @@ while [[ $# -gt 0 && "$1" != "--" ]]; do
138142
S) _run_all_sfs=true ;;
139143
c) _update_cron=true ;;
140144
e) _email="${OPTARG}" && _set_email=true ;;
145+
t) _tag="_${OPTARG}" ;;
141146
v) _verbose=true ;;
142147
V) _very_verbose=true && _verbose=true && _verbose_flag="-v" ;;
143148
d) _debug=true && _very_verbose=true && _verbose=true && _verbose_flag="-v" && PS4='${LINENO}: ' ;;
@@ -454,11 +459,12 @@ echo "Running create_experiment.py for ${#_yaml_list[@]} cases"
454459
[[ "${_verbose}" == true ]] && printf "Selected cases: %s\n\n" "${_yaml_list[*]}"
455460
for _case in "${_yaml_list[@]}"; do
456461
[[ "${_verbose}" == false ]] && echo "${_case}"
462+
_pslot="${_case}${_tag}"
457463
_create_exp_cmd="./create_experiment.py -y ../ci/cases/pr/${_case}.yaml --overwrite"
458464
if [[ "${_verbose}" == true ]]; then
459-
pslot=${_case} RUNTESTS=${_runtests} ${_create_exp_cmd}
465+
pslot=${_pslot} RUNTESTS=${_runtests} ${_create_exp_cmd}
460466
else
461-
if ! pslot=${_case} RUNTESTS=${_runtests} ${_create_exp_cmd} 2> stderr 1> stdout; then
467+
if ! pslot=${_pslot} RUNTESTS=${_runtests} ${_create_exp_cmd} 2> stderr 1> stdout; then
462468
_output=$(cat stdout stderr)
463469
_message="The create_experiment command (${_create_exp_cmd}) failed with a non-zero status. Output:"
464470
_message="${_message}"$'\n'"${_output}"
@@ -471,7 +477,7 @@ for _case in "${_yaml_list[@]}"; do
471477
fi
472478
rm -f stdout stderr
473479
fi
474-
grep "${_case}" "${_runtests}/EXPDIR/${_case}/${_case}.crontab" >> tests.cron
480+
grep "${_pslot}" "${_runtests}/EXPDIR/${_pslot}/${_pslot}.crontab" >> tests.cron
475481
done
476482
echo
477483

0 commit comments

Comments
 (0)