-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'NOAA-EMC:develop' into gw_ci_20240506
- Loading branch information
Showing
392 changed files
with
4,557 additions
and
2,942 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
experiment: | ||
system: gfs | ||
mode: cycled | ||
|
||
arguments: | ||
pslot: {{ 'pslot' | getenv }} | ||
app: S2S | ||
resdetatmos: 384 | ||
resdetocean: 0.25 | ||
nens: 0 | ||
gfs_cyc: 4 | ||
start: cold | ||
comroot: {{ 'RUNTESTS' | getenv }}/COMROOT | ||
expdir: {{ 'RUNTESTS' | getenv }}/EXPDIR | ||
idate: 2021063000 | ||
edate: 2021070306 | ||
icsdir: /scratch1/NCEPDEV/climate/Jessica.Meixner/cycling/IC_2021063000_V2 | ||
yaml: {{ HOMEgfs }}/ci/cases/gfsv17/ocnanal.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
defaults: | ||
!INC {{ HOMEgfs }}/parm/config/gfs/yaml/defaults.yaml | ||
|
||
base: | ||
DOIAU: "YES" | ||
DO_JEDIATMVAR: "NO" | ||
DO_JEDIATMENS: "NO" | ||
DO_JEDIOCNVAR: "YES" | ||
DO_JEDISNOWDA: "NO" | ||
DO_MERGENSST: "NO" | ||
DOHYBVAR: "NO" | ||
DO_FIT2OBS: "YES" | ||
DO_VERFOZN: "YES" | ||
DO_VERFRAD: "YES" | ||
DO_VRFY_OCEANDA: "NO" | ||
FHMAX_GFS: 240 | ||
|
||
ocnanal: | ||
SOCA_INPUT_FIX_DIR: /scratch2/NCEPDEV/ocean/Guillaume.Vernieres/data/static/1440x1080x75/soca | ||
CASE_ANL: 'C24' | ||
SOCA_OBS_LIST: {{ HOMEgfs }}/sorc/gdas.cd/parm/soca/obs/obs_list.yaml | ||
SOCA_NINNER: 100 | ||
SABER_BLOCKS_YAML: '' | ||
NICAS_RESOL: 1 | ||
NICAS_GRID_SIZE: 15000 | ||
|
||
prepoceanobs: | ||
SOCA_OBS_LIST: {{ HOMEgfs }}/sorc/gdas.cd/parm/soca/obs/obs_list.yaml | ||
OBSPREP_YAML: {{ HOMEgfs }}/sorc/gdas.cd/parm/soca/obsprep/obsprep_config.yaml | ||
DMPDIR: /scratch1/NCEPDEV/da/common/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
defaults: | ||
!INC {{ HOMEgfs }}/parm/config/gfs/yaml/defaults.yaml | ||
base: | ||
DOIAU: "NO" | ||
DO_JEDISNOWDA: "YES" | ||
ACCOUNT: {{ 'SLURM_ACCOUNT' | getenv }} | ||
ACCOUNT: {{ 'HPC_ACCOUNT' | getenv }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
defaults: | ||
!INC {{ HOMEgfs }}/parm/config/gefs/yaml/defaults.yaml | ||
base: | ||
ACCOUNT: {{ 'SLURM_ACCOUNT' | getenv }} | ||
HPC_ACCOUNT: {{ 'HPC_ACCOUNT' | getenv }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
defaults: | ||
!INC {{ HOMEgfs }}/parm/config/gfs/yaml/defaults.yaml | ||
base: | ||
ACCOUNT: {{ 'SLURM_ACCOUNT' | getenv }} | ||
ACCOUNT: {{ 'HPC_ACCOUNT' | getenv }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
defaults: | ||
!INC {{ HOMEgfs }}/parm/config/gfs/yaml/defaults.yaml | ||
base: | ||
ACCOUNT: {{ 'SLURM_ACCOUNT' | getenv }} | ||
ACCOUNT: {{ 'HPC_ACCOUNT' | getenv }} | ||
DO_JEDIOCNVAR: "YES" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#!/bin/env bash | ||
set -e | ||
|
||
controller_url="https://jenkins.epic.oarcloud.noaa.gov" | ||
controller_user="terry.mcguinness" | ||
HOMEgfs="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." >/dev/null 2>&1 && pwd )" | ||
host=$(hostname) | ||
|
||
######################################################################### | ||
# Set up runtime environment varibles for accounts on supproted machines | ||
######################################################################### | ||
|
||
source "${HOMEgfs}/ush/detect_machine.sh" | ||
case ${MACHINE_ID} in | ||
hera | orion | hercules | wcoss2) | ||
echo "Launch Jenkins Java Controler on ${MACHINE_ID}" | ||
;; | ||
*) | ||
echo "Unsupported platform. Exiting with error." | ||
exit 1 | ||
;; | ||
esac | ||
|
||
LOG=lanuched_agent-$(date +%Y%m%d%M).log | ||
rm -f "${LOG}" | ||
|
||
source "${HOMEgfs}/ush/module-setup.sh" | ||
module use "${HOMEgfs}/modulefiles" | ||
module load "module_gwsetup.${MACHINE_ID}" | ||
source "${HOMEgfs}/ci/platforms/config.${MACHINE_ID}" | ||
|
||
JAVA_HOME="${JENKINS_AGENT_LANUCH_DIR}/JAVA/jdk-17.0.10" | ||
if [[ ! -d "${JAVA_HOME}" ]]; then | ||
JAVA_HOME=/usr/lib/jvm/jre-17 | ||
if [[ ! -d "${JAVA_HOME}" ]]; then | ||
echo "ERROR: JAVA_HOME not found. Exiting with error." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
JAVA="${JAVA_HOME}/bin/java" | ||
echo "JAVA VERSION: " | ||
${JAVA} -version | ||
|
||
export GH="${HOME}/bin/gh" | ||
command -v "${GH}" | ||
${GH} --version | ||
|
||
if [[ -d "${JENKINS_AGENT_LANUCH_DIR}" ]]; then | ||
echo "Jenkins Agent Lanuch Directory: ${JENKINS_AGENT_LANUCH_DIR}" | ||
else | ||
echo "ERROR: Jenkins Agent Lanuch Directory not found. Exiting with error." | ||
exit 1 | ||
fi | ||
cd "${JENKINS_AGENT_LANUCH_DIR}" | ||
|
||
if ! [[ -f agent.jar ]]; then | ||
curl -sO "${controller_url}/jnlpJars/agent.jar" | ||
fi | ||
|
||
JENKINS_TOKEN=$(cat jenkins_token) | ||
|
||
# | ||
offline=$(curl --silent -u "${controller_user}:${JENKINS_TOKEN}" "${controller_url}/computer/${MACHINE_ID^}-EMC/api/json?pretty=true" | grep '\"offline\"' | awk '{gsub(/,/,"");print $3}') || true | ||
echo "Jenkins Agent offline setting: ${offline}" | ||
|
||
if [[ "${offline}" == "true" ]]; then | ||
echo "Jenkins Agent is offline. Lanuching Jenkins Agent on ${host}" | ||
command="nohup ${JAVA} -jar agent.jar -jnlpUrl ${controller_url}/computer/${MACHINE_ID^}-EMC/jenkins-agent.jnlp -secret @jenkins-secret-file -workDir ${JENKINS_WORK_DIR}" | ||
echo -e "Lanuching Jenkins Agent on ${host} with the command:\n${command}" >& "${LOG}" | ||
${command} >> "${LOG}" 2>&1 & | ||
nohup_PID=$! | ||
echo "Java agent running on PID: ${nohup_PID}" >> "${LOG}" 2>&1 | ||
echo "Java agent running on PID: ${nohup_PID}" | ||
else | ||
echo "Jenkins Agent is online (nothing done)" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#!/usr/bin/env python3 | ||
|
||
""" | ||
This script parses a yaml file and returns the value of a specified key. | ||
""" | ||
|
||
import os | ||
import sys | ||
from wxflow import AttrDict, parse_j2yaml | ||
from argparse import ArgumentParser | ||
from pathlib import Path | ||
|
||
_here = os.path.dirname(__file__) | ||
_top = os.path.abspath(os.path.join(os.path.abspath(_here), '../../..')) | ||
|
||
description = """parse yaml file and return value of key""" | ||
|
||
|
||
def parse_args(): | ||
""" | ||
Parse command-line arguments. | ||
Returns: | ||
argparse.Namespace: The parsed command-line arguments. | ||
""" | ||
|
||
parser = ArgumentParser(description=description) | ||
parser.add_argument('-y', '--yaml', help='full path to yaml file to parse', type=Path, required=True) | ||
parser.add_argument('-k', '--key', help='key to return value of', type=str, required=True) | ||
parser.add_argument('-s', '--string', help='output results as strings', action="store_true", required=False) | ||
return parser.parse_args() | ||
|
||
|
||
def yq(yamlfile, key): | ||
""" | ||
Parse a yaml file and return the value of a specified key. | ||
Args: | ||
yamlfile (Path): The path to the yaml file. | ||
key (str): The key to return the value of. | ||
Returns: | ||
The value of the specified key in the yaml file. | ||
""" | ||
|
||
data = AttrDict(HOMEgfs=_top) | ||
data.update({'HOMEgfs': _top}) | ||
ydict = parse_j2yaml(path=yamlfile, data=data) | ||
if key == 'all': | ||
return ydict | ||
list_keys = key.split('.') | ||
for k in list_keys: | ||
ydict = ydict.get(k, None) | ||
if ydict is None: | ||
break | ||
return ydict | ||
|
||
|
||
if __name__ == '__main__': | ||
""" | ||
Main function. Parses command-line arguments and prints the value of the specified key in the specified yaml file. | ||
""" | ||
|
||
args = parse_args() | ||
values = yq(args.yaml, args.key) | ||
if args.string and isinstance(values, list): | ||
for value in values: | ||
print(value) | ||
else: | ||
print(values) |
Oops, something went wrong.