Skip to content

Commit

Permalink
Merge remote-tracking branch 'emc/develop' into ss160
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidHuber-NOAA committed Feb 9, 2024
2 parents b972f66 + 54daa31 commit 28ccf78
Show file tree
Hide file tree
Showing 69 changed files with 715 additions and 931 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,16 @@ parm/post/nam_micro_lookup.dat
parm/post/optics_luts_DUST.dat
parm/post/gtg.config.gfs
parm/post/gtg_imprintings.txt
parm/post/optics_luts_DUST_nasa.dat
parm/post/optics_luts_NITR_nasa.dat
parm/post/optics_luts_SALT.dat
parm/post/optics_luts_SALT_nasa.dat
parm/post/optics_luts_SOOT.dat
parm/post/optics_luts_SOOT_nasa.dat
parm/post/optics_luts_SUSO.dat
parm/post/optics_luts_SUSO_nasa.dat
parm/post/optics_luts_WASO.dat
parm/post/optics_luts_WASO_nasa.dat
parm/post/params_grib2_tbl_new
parm/post/post_tag_gfs128
parm/post/post_tag_gfs65
Expand All @@ -77,6 +83,9 @@ parm/post/postcntrl_gfs_wafs.xml
parm/post/postcntrl_gfs_wafs_anl.xml
parm/post/postxconfig-NT-GEFS-ANL.txt
parm/post/postxconfig-NT-GEFS-F00.txt
parm/post/postxconfig-NT-GEFS-F00-aerosol.txt
parm/post/postxconfig-NT-GEFS-WAFS.txt
parm/post/postxconfig-NT-GEFS-aerosol.txt
parm/post/postxconfig-NT-GEFS.txt
parm/post/postxconfig-NT-GFS-ANL.txt
parm/post/postxconfig-NT-GFS-F00-TWO.txt
Expand Down
188 changes: 188 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
def Machine = 'none'
def machine = 'none'
def HOME = 'none'
def localworkspace = 'none'
def commonworkspace = 'none'

pipeline {
agent { label 'built-in' }

options {
skipDefaultCheckout()
buildDiscarder(logRotator(numToKeepStr: '2'))
}

stages { // This initial stage is used to get the Machine name from the GitHub labels on the PR
// which is used to designate the Nodes in the Jenkins Controler by the agent label
// Each Jenknis Node is connected to said machine via an JAVA agent via an ssh tunnel

stage('Get Machine') {
agent { label 'built-in' }
steps {
script {
localworkspace = env.WORKSPACE
machine = 'none'
for (label in pullRequest.labels) {
echo "Label: ${label}"
if ((label.matches("CI-Hera-Ready"))) {
machine = 'hera'
} else if ((label.matches("CI-Orion-Ready"))) {
machine = 'orion'
} else if ((label.matches("CI-Hercules-Ready"))) {
machine = 'hercules'
}
} // createing a second machine varible with first letter capital
// because the first letter of the machine name is captitalized in the GitHub labels
Machine = machine[0].toUpperCase() + machine.substring(1)
}
}
}

stage('Get Common Workspace') {
agent { label "${machine}-emc" }
steps {
script {
properties([parameters([[$class: 'NodeParameterDefinition', allowedSlaves: ['built-in','Hera-EMC','Orion-EMC'], defaultSlaves: ['built-in'], name: '', nodeEligibility: [$class: 'AllNodeEligibility'], triggerIfResult: 'allCases']])])
HOME = "${WORKSPACE}/TESTDIR"
commonworkspace = "${WORKSPACE}"
sh( script: "mkdir -p ${HOME}/RUNTESTS", returnStatus: true)
pullRequest.addLabel("CI-${Machine}-Building")
if ( pullRequest.labels.any{ value -> value.matches("CI-${Machine}-Ready") } ) {
pullRequest.removeLabel("CI-${Machine}-Ready")
}
}
}
}

stage('Build System') {
matrix {
agent { label "${machine}-emc" }
//options {
// throttle(['global_matrix_build'])
//}
axes {
axis {
name "system"
values "gfs", "gefs"
}
}
stages {
stage("build system") {
steps {
script {
def HOMEgfs = "${HOME}/${system}" // local HOMEgfs is used to build the system on per system basis under the common workspace HOME
sh( script: "mkdir -p ${HOMEgfs}", returnStatus: true)
ws(HOMEgfs) {
env.MACHINE_ID = machine // MACHINE_ID is used in the build scripts to determine the machine and is added to the shell environment
if (fileExists("${HOMEgfs}/sorc/BUILT_semaphor")) { // if the system is already built, skip the build in the case of re-runs
sh( script: "cat ${HOMEgfs}/sorc/BUILT_semaphor", returnStdout: true).trim() // TODO: and user configurable control to manage build semphore
ws(commonworkspace) { pullRequest.comment("Cloned PR already built (or build skipped) on ${machine} in directory ${HOMEgfs}") }
} else {
checkout scm
sh( script: "source workflow/gw_setup.sh;which git;git --version;git submodule update --init --recursive", returnStatus: true)
def builds_file = readYaml file: "ci/cases/yamls/build.yaml"
def build_args_list = builds_file['builds']
def build_args = build_args_list[system].join(" ").trim().replaceAll("null", "")
dir("${HOMEgfs}/sorc") {
sh( script: "${build_args}", returnStatus: true)
sh( script: "./link_workflow.sh", returnStatus: true)
sh( script: "echo ${HOMEgfs} > BUILT_semaphor", returnStatus: true)
}
}
if ( pullRequest.labels.any{ value -> value.matches("CI-${Machine}-Building") } ) {
pullRequest.removeLabel("CI-${Machine}-Building")
}
pullRequest.addLabel("CI-${Machine}-Running")
}
}
}
}
}
}
}

stage('Run Tests') {
matrix {
agent { label "${machine}-emc" }
axes {
axis {
name "Case"
values "C48_ATM", "C48_S2SWA_gefs", "C48_S2SW", "C96_atm3DVar" // TODO add dynamic list of cases from env vars (needs addtional plugins)
}
}
stages {
stage('Create Experiment') {
steps {
script {
sh( script: "sed -n '/{.*}/!p' ${HOME}/gfs/ci/cases/pr/${Case}.yaml > ${HOME}/gfs/ci/cases/pr/${Case}.yaml.tmp", returnStatus: true)
def yaml_case = readYaml file: "${HOME}/gfs/ci/cases/pr/${Case}.yaml.tmp"
system = yaml_case.experiment.system
def HOMEgfs = "${HOME}/${system}" // local HOMEgfs is used to populate the XML on per system basis
env.RUNTESTS = "${HOME}/RUNTESTS"
sh( script: "${HOMEgfs}/ci/scripts/utils/ci_utils_wrapper.sh create_experiment ${HOMEgfs}/ci/cases/pr/${Case}.yaml", returnStatus: true)
}
}
}
stage('Run Experiments') {
steps {
script {
HOMEgfs = "${HOME}/gfs" // common HOMEgfs is used to launch the scripts that run the experiments
ws(HOMEgfs) {
pslot = sh( script: "${HOMEgfs}/ci/scripts/utils/ci_utils_wrapper.sh get_pslot ${HOME}/RUNTESTS ${Case}", returnStdout: true ).trim()
pullRequest.comment("**Running experiments: ${Case} on ${Machine}**<br>Built against system **${system}** in directory:<br>`${HOMEgfs}`<br>With the experiment in directory:<br>`${HOME}/RUNTESTS/${pslot}`")
try {
sh( script: "${HOMEgfs}/ci/scripts/run-check_ci.sh ${HOME} ${pslot}", returnStatus: true)
} catch (Exception e) {
pullRequest.comment("**FAILURE** running experiments: ${Case} on ${Machine}")
error("Failed to run experiments ${Case} on ${Machine}")
}
pullRequest.comment("**SUCCESS** running experiments: ${Case} on ${Machine}")
}
}
}
post {
always {
script {
ws (HOMEgfs) {
for (label in pullRequest.labels) {
if (label.contains("${Machine}")) {
pullRequest.removeLabel(label)
}
}
}
}
}
success {
script {
ws (HOMEgfs) {
pullRequest.addLabel("CI-${Machine}-Passed")
def timestamp = new Date().format("MM dd HH:mm:ss", TimeZone.getTimeZone('America/New_York'))
pullRequest.comment("**CI SUCCESS** ${Machine} at ${timestamp}\n\nBuilt and ran in directory `${HOME}`")
}
}
}
failure {
script {
ws (HOMEgfs) {
pullRequest.addLabel("CI-${Machine}-Failed")
def timestamp = new Date().format("MM dd HH:mm:ss", TimeZone.getTimeZone('America/New_York'))
pullRequest.comment("**CI FAILED** ${Machine} at ${timestamp}<br>Built and ran in directory `${HOME}`")
if (fileExists('${HOME}/RUNTESTS/ci.log')) {
def fileContent = readFile '${HOME}/RUNTESTS/ci.log'
fileContent.eachLine { line ->
if( line.contains(".log")) {
archiveArtifacts artifacts: "${line}", fingerprint: true
}
}
}
}
}
}
}
}
}
}
}
}

}
2 changes: 1 addition & 1 deletion ci/cases/pr/C48_ATM.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ arguments:
expdir: {{ 'RUNTESTS' | getenv }}/EXPDIR
idate: 2021032312
edate: 2021032312
yaml: {{ HOMEgfs }}/ci/platforms/gfs_defaults_ci.yaml
yaml: {{ HOMEgfs }}/ci/cases/yamls/gfs_defaults_ci.yaml
2 changes: 1 addition & 1 deletion ci/cases/pr/C48_S2SW.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ arguments:
expdir: {{ 'RUNTESTS' | getenv }}/EXPDIR
idate: 2021032312
edate: 2021032312
yaml: {{ HOMEgfs }}/ci/platforms/gfs_defaults_ci.yaml
yaml: {{ HOMEgfs }}/ci/cases/yamls/gfs_defaults_ci.yaml
2 changes: 1 addition & 1 deletion ci/cases/pr/C48_S2SWA_gefs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ arguments:
expdir: {{ 'RUNTESTS' | getenv }}/EXPDIR
idate: 2021032312
edate: 2021032312
yaml: {{ HOMEgfs }}/ci/platforms/gefs_ci_defaults.yaml
yaml: {{ HOMEgfs }}/ci/cases/yamls/gefs_ci_defaults.yaml
22 changes: 22 additions & 0 deletions ci/cases/pr/C48mx500_3DVarAOWCDA.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
experiment:
system: gfs
mode: cycled

arguments:
pslot: {{ 'pslot' | getenv }}
app: S2S
resdetatmos: 48
resdetocean: 5.0
comroot: {{ 'RUNTESTS' | getenv }}/COMROOT
expdir: {{ 'RUNTESTS' | getenv }}/EXPDIR
icsdir: {{ 'ICSDIR_ROOT' | getenv }}/C48mx500
idate: 2021032412
edate: 2021032418
nens: 0
gfs_cyc: 0
start: warm
yaml: {{ HOMEgfs }}/ci/cases/yamls/soca_gfs_defaults_ci.yaml

skip_ci_on_hosts:
- orion
- hercules
2 changes: 1 addition & 1 deletion ci/cases/pr/C96C48_hybatmDA.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ arguments:
nens: 2
gfs_cyc: 1
start: cold
yaml: {{ HOMEgfs }}/ci/platforms/gfs_defaults_ci.yaml
yaml: {{ HOMEgfs }}/ci/cases/yamls/gfs_defaults_ci.yaml
2 changes: 1 addition & 1 deletion ci/cases/pr/C96_atm3DVar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ arguments:
nens: 0
gfs_cyc: 1
start: cold
yaml: {{ HOMEgfs }}/ci/platforms/gfs_defaults_ci.yaml
yaml: {{ HOMEgfs }}/ci/cases/yamls/gfs_defaults_ci.yaml
21 changes: 21 additions & 0 deletions ci/cases/pr/C96_atmsnowDA.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
experiment:
system: gfs
mode: cycled

arguments:
pslot: {{ 'pslot' | getenv }}
app: ATM
resdetatmos: 96
comroot: {{ 'RUNTESTS' | getenv }}/COMROOT
expdir: {{ 'RUNTESTS' | getenv }}/EXPDIR
icsdir: {{ 'ICSDIR_ROOT' | getenv }}/C96C48
idate: 2021122012
edate: 2021122100
nens: 0
gfs_cyc: 1
start: cold
yaml: {{ HOMEgfs }}/ci/cases/yamls/atmsnowDA_defaults_ci.yaml

skip_ci_on_hosts:
- orion
- hercules
2 changes: 1 addition & 1 deletion ci/cases/weekly/C384C192_hybatmda.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ arguments:
nens: 2
gfs_cyc: 1
start: cold
yaml: {{ HOMEgfs }}/ci/platforms/gfs_defaults_ci.yaml
yaml: {{ HOMEgfs }}/ci/cases/yamls/gfs_defaults_ci.yaml
2 changes: 1 addition & 1 deletion ci/cases/weekly/C384_S2SWA.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ arguments:
expdir: {{ 'RUNTESTS' | getenv }}/EXPDIR
idate: 2016070100
edate: 2016070100
yaml: {{ HOMEgfs }}/ci/platforms/gfs_defaults_ci.yaml
yaml: {{ HOMEgfs }}/ci/cases/yamls/gfs_defaults_ci.yaml
2 changes: 1 addition & 1 deletion ci/cases/weekly/C384_atm3DVar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ arguments:
nens: 0
gfs_cyc: 1
start: cold
yaml: {{ HOMEgfs }}/ci/platforms/gfs_defaults_ci.yaml
yaml: {{ HOMEgfs }}/ci/cases/yamls/gfs_defaults_ci.yaml
6 changes: 6 additions & 0 deletions ci/cases/yamls/atmsnowDA_defaults_ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
defaults:
!INC {{ HOMEgfs }}/parm/config/gfs/yaml/defaults.yaml
base:
DOIAU: "NO"
DO_JEDILANDDA: "YES"
ACCOUNT: {{ 'SLURM_ACCOUNT' | getenv }}
3 changes: 3 additions & 0 deletions ci/cases/yamls/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
builds:
- gefs: './build_all.sh'
- gfs: './build_all.sh -gu'
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions ci/cases/yamls/soca_gfs_defaults_ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
defaults:
!INC {{ HOMEgfs }}/parm/config/gfs/yaml/defaults.yaml
base:
ACCOUNT: {{ 'SLURM_ACCOUNT' | getenv }}
DO_JEDIOCNVAR: "YES"
4 changes: 3 additions & 1 deletion ci/scripts/run-check_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ pslot=${2:-${pslot:-?}} # Name of the experiment being tested by this scr
# │   └── ${pslot}
# └── EXPDIR
# └── ${pslot}
HOMEgfs="${TEST_DIR}/HOMEgfs"
# Two system build directories created at build time gfs, and gdas
# TODO: Make this configurable (for now all scripts run from gfs for CI at runtime)
HOMEgfs="${TEST_DIR}/gfs"
RUNTESTS="${TEST_DIR}/RUNTESTS"

# Source modules and setup logging
Expand Down
Loading

0 comments on commit 28ccf78

Please sign in to comment.