Skip to content

Commit

Permalink
Merge branch 'develop' into feature/marineenvar
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumevernieres committed Nov 19, 2024
2 parents 68b24d4 + 7ff942e commit 6f00478
Show file tree
Hide file tree
Showing 100 changed files with 1,589 additions and 924 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pw_aws_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ jobs:
id: get-branch
run: |
pr_number=${{ github.event.inputs.pr_number }}
repo=${{ github.repository }}
if [ "$pr_number" -eq "0" ]; then
branch=${{ github.event.inputs.ref }}
repo=${{ github.repository }}
else
branch=$(gh pr view $pr_number --repo $repo --json headRefName --jq '.headRefName')
repo_owner=$(gh pr view $pr_number --repo $repo --json headRepositoryOwner --jq '.headRepositoryOwner.login')
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ parm/post/params_grib2_tbl_new
parm/post/post_tag_gfs128
parm/post/gfs
parm/post/gefs
parm/post/sfs
parm/post/ocean.csv
parm/post/ice.csv
parm/post/ocnicepost.nml.jinja2
Expand Down
1 change: 1 addition & 0 deletions ci/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ pipeline {
def build_system = yaml_case.experiment.system
try {
sh(script: "${HOMEgfs}/ci/scripts/run-check_ci.sh ${CUSTOM_WORKSPACE} ${pslot} ${build_system}")
sh(script: "${HOMEgfs}/ci/scripts/utils/ci_utils_wrapper.sh cleanup_experiment ${CUSTOM_WORKSPACE}/RUNTESTS/EXPDIR/${pslot}")
} catch (Exception error_experment) {
sh(script: "${HOMEgfs}/ci/scripts/utils/ci_utils_wrapper.sh cancel_batch_jobs ${pslot}")
ws(CUSTOM_WORKSPACE) {
Expand Down
2 changes: 1 addition & 1 deletion ci/cases/pr/C96C48_ufs_hybatmDA.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ skip_ci_on_hosts:
- gaea
- orion
- hercules

- wcoss2
19 changes: 19 additions & 0 deletions ci/cases/sfs/C96mx100_S2S.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
experiment:
system: gefs
mode: forecast-only

arguments:
idate: 1994050100
edate: 1994050100
pslot: {{ 'pslot' | getenv }}
app: S2S
resdetatmos: 96
resensatmos: 96
resdetocean: 1
start: 'cold'
nens: 10
comroot: {{ 'RUNTESTS' | getenv }}/COMROOT
expdir: {{ 'RUNTESTS' | getenv }}/EXPDIR
icsdir: {{ 'TOPICDIR' | getenv }}/HR4/C96mx100
yaml: {{ HOMEgfs }}/ci/cases/yamls/sfs_defaults.yaml

8 changes: 8 additions & 0 deletions ci/cases/yamls/gefs_defaults_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,11 @@ defaults:
!INC {{ HOMEgfs }}/parm/config/gefs/yaml/defaults.yaml
base:
ACCOUNT: {{ 'HPC_ACCOUNT' | getenv }}
SFS_POST: "NO"
FHOUT_GFS: 6
stage_ic:
USE_OCN_ENS_PERTURB_FILES: "NO"
USE_ATM_ENS_PERTURB_FILES: "NO"
ocn:
MOM6_INTERP_ICS: "NO"

4 changes: 4 additions & 0 deletions ci/cases/yamls/gefs_replay_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@ base:
FHOUT_OCN_GFS: 24
FHOUT_ICE_GFS: 24
HOMEDIR: {{ 'RUNTESTS' | getenv }}/GLOBAL
SFS_POST: "NO"
stage_ic:
USE_OCN_ENS_PERTURB_FILES: "YES"
USE_ATM_ENS_PERTURB_FILES: "YES"

33 changes: 33 additions & 0 deletions ci/cases/yamls/sfs_defaults.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
base:
DO_JEDIATMVAR: "NO"
DO_JEDIATMENS: "NO"
DO_JEDIOCNVAR: "NO"
DO_JEDISNOWDA: "NO"
DO_MERGENSST: "NO"
DO_BUFRSND: "NO"
DO_GEMPAK: "NO"
DO_AWIPS: "NO"
KEEPDATA: "YES"
DO_EXTRACTVARS: "NO"
FHMAX_GFS: 2976
FHMAX_HF_GFS: 0
FHOUT_HF_GFS: 1
FHOUT_GFS: 24
FHOUT_OCN_GFS: 24
FHOUT_ICE_GFS: 24
FCST_BREAKPOINTS: ""
REPLAY_ICS: "NO"
HPSSARCH: "NO"
LOCALARCH: "NO"
SFS_POST: "YES"
ACCOUNT: {{ 'HPC_ACCOUNT' | getenv }}
fcst:
TYPE: "hydro"
MONO: "mono"
reforecast: "YES"
FHZER: 24
stage_ic:
USE_OCN_ENS_PERTURB_FILES: "YES"
USE_ATM_ENS_PERTURB_FILES: "YES"
ocn:
MOM6_INTERP_ICS: "YES"
1 change: 0 additions & 1 deletion ci/cases/yamls/ufs_hybatmDA_defaults.ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ nsst:
NST_MODEL: "1"
sfcanl:
DONST: "NO"

3 changes: 1 addition & 2 deletions ci/scripts/check_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ for pr in ${pr_list}; do
fi
if [[ "${rocoto_state}" == "DONE" ]]; then
#Remove Experment cases that completed successfully
rm -Rf "${pslot_dir}"
rm -Rf "${pr_dir}/RUNTESTS/COMROOT/${pslot}"
"${HOMEgfs}/ci/scripts/utils/ci_utils_wrapper.sh" cleanup_experiment "${pslot_dir}"
rm -f "${output_ci_single}"
# echo "\`\`\`" > "${output_ci_single}"
DATE=$(date +'%D %r')
Expand Down
26 changes: 24 additions & 2 deletions ci/scripts/utils/ci_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ function create_experiment () {
source "${HOMEgfs}/ci/platforms/config.${MACHINE_ID}"
source "${HOMEgfs}/workflow/gw_setup.sh"

# Remove RUNDIRS dir incase this is a retry
# Remove RUNDIRS dir incase this is a retry (STMP now in host file)
STMP=$("${HOMEgfs}/ci/scripts/utils/parse_yaml.py" -y "${HOMEgfs}/workflow/hosts/${MACHINE_ID}.yaml" -k STMP -s)
echo "Removing ${STMP}/RUNDIRS/${pslot} directory incase this is a retry"
rm -Rf "${STMP}/RUNDIRS/${pslot}"

"${HOMEgfs}/${system}/workflow/create_experiment.py" --overwrite --yaml "${yaml_config}"
Expand All @@ -137,7 +139,6 @@ function publish_logs() {
local PR_header="$1"
local dir_path="$2"
local file="$3"

local full_paths=""
while IFS= read -r line; do
full_path="${dir_path}/${line}"
Expand All @@ -155,3 +156,24 @@ function publish_logs() {
fi
echo "${URL}"
}

function cleanup_experiment() {

local EXPDIR="$1"
local pslot
local ARCDIR
local ATARDIR
local COMROOT

EXPDIR="$1"
pslot=$(basename "${EXPDIR}")

# Use the Python utility to get the required variables
read -r ARCDIR ATARDIR STMP COMROOT < <("${HOMEgfs}/ci/scripts/utils/get_config_var.py" ARCDIR ATARDIR STMP COMROOT "${EXPDIR}") || true

rm -Rf "${ARCDIR:?}"
rm -Rf "${ATARDIR:?}"
rm -Rf "${COMROOT}/${pslot:?}"
rm -Rf "${EXPDIR}/${pslot:?}"
rm -Rf "${STMP}/RUNDIRS/${pslot:?}"
}
43 changes: 43 additions & 0 deletions ci/scripts/utils/get_config_var.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env python3

import os
import argparse
from wxflow import Configuration


def get_config_vars(var_names, config_path):
"""
GET_CONFIG_VARS Get configuration variables from a config file or directory.
Parameters:
var_names (list of str): The names of the configuration variables to retrieve.
config_path (str): The path to the configuration file or directory.
Returns:
list of str: The values of the specified configuration variables.
"""
if os.path.isfile(config_path):
config_dir = os.path.dirname(config_path)
config_file = os.path.basename(config_path)
elif os.path.isdir(config_path):
config_dir = config_path
config_file = 'config.base'
config = Configuration(config_dir)
config_data = config.parse_config(config_file)
return [config_data[var_name] for var_name in var_names]


if __name__ == "__main__":
"""
Main entry point for the script.
Parses command-line arguments and retrieves the specified configuration variables.
"""
parser = argparse.ArgumentParser(description="Get configuration variables from a config file or directory.")
parser.add_argument("var_names", nargs='+', help="The names of the configuration variables to retrieve.")
parser.add_argument("config_path", help="The path to the configuration file or directory.")

args = parser.parse_args()

var_names = args.var_names
config_path = args.config_path

values = get_config_vars(var_names, config_path)
print(" ".join(values))
6 changes: 2 additions & 4 deletions env/HERA.env
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ if [[ "${step}" = "prep" ]] || [[ "${step}" = "prepbufr" ]]; then
export sys_tp="HERA"
export launcher_PREP="srun --hint=nomultithread"

elif [[ "${step}" = "prepsnowobs" ]]; then

export APRUN_CALCFIMS="${APRUN_default}"

elif [[ "${step}" = "prep_emissions" ]]; then

export APRUN="${APRUN_default}"
Expand Down Expand Up @@ -116,6 +112,8 @@ elif [[ "${step}" = "prepobsaero" ]]; then

elif [[ "${step}" = "snowanl" ]]; then

export APRUN_CALCFIMS="${launcher} -n 1"

export NTHREADS_SNOWANL=${NTHREADSmax}
export APRUN_SNOWANL="${APRUN_default} --cpus-per-task=${NTHREADS_SNOWANL}"

Expand Down
13 changes: 9 additions & 4 deletions env/HERCULES.env
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ case ${step} in
export sys_tp="HERCULES"
export launcher_PREP="srun --hint=nomultithread"
;;
"prepsnowobs")

export APRUN_CALCFIMS="${APRUN_default}"
;;
"prep_emissions")

export APRUN="${APRUN_default}"
Expand Down Expand Up @@ -115,6 +111,8 @@ case ${step} in
;;
"snowanl")

export APRUN_CALCFIMS="${launcher} -n 1"

export NTHREADS_SNOWANL=${NTHREADSmax}
export APRUN_SNOWANL="${APRUN_default} --cpus-per-task=${NTHREADS_SNOWANL}"

Expand All @@ -139,15 +137,22 @@ case ${step} in
export APRUN_MARINEANLVAR="${APRUN_default}"
;;
"ocnanalecen")

export APRUN_OCNANALECEN="${APRUN_default}"
;;

"marineanlchkpt")

export APRUNCFP="${launcher} -n \$ncmd ${mpmd_opt}"

export NTHREADS_OCNANAL=${NTHREADSmax}
export APRUN_MARINEANLCHKPT="${APRUN_default} --cpus-per-task=${NTHREADS_OCNANAL}"
;;
"marineanlletkf")

export NTHREADS_MARINEANLLETKF=${NTHREADSmax}
export APRUN_MARINEANLLETKF="${APRUN_default}"
;;
"anal" | "analcalc")

export MKL_NUM_THREADS=4
Expand Down
6 changes: 2 additions & 4 deletions env/JET.env
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ if [[ "${step}" = "prep" ]] || [[ "${step}" = "prepbufr" ]]; then
export sys_tp="JET"
export launcher_PREP="srun"

elif [[ "${step}" = "prepsnowobs" ]]; then

export APRUN_CALCFIMS="${launcher} -n 1"

elif [[ "${step}" = "prep_emissions" ]]; then

export APRUN="${launcher} -n 1"
Expand Down Expand Up @@ -99,6 +95,8 @@ elif [[ "${step}" = "prepobsaero" ]]; then

elif [[ "${step}" = "snowanl" ]]; then

export APRUN_CALCFIMS="${launcher} -n 1"

export NTHREADS_SNOWANL=${NTHREADSmax}
export APRUN_SNOWANL="${APRUN_default}"

Expand Down
6 changes: 2 additions & 4 deletions env/ORION.env
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ if [[ "${step}" = "prep" ]] || [[ "${step}" = "prepbufr" ]]; then
export sys_tp="ORION"
export launcher_PREP="srun --hint=nomultithread"

elif [[ "${step}" = "prepsnowobs" ]]; then

export APRUN_CALCFIMS="${launcher} -n 1"

elif [[ "${step}" = "prep_emissions" ]]; then

export APRUN="${launcher} -n 1"
Expand Down Expand Up @@ -106,6 +102,8 @@ elif [[ "${step}" = "prepobsaero" ]]; then

elif [[ "${step}" = "snowanl" ]]; then

export APRUN_CALCFIMS="${launcher} -n 1"

export NTHREADS_SNOWANL=${NTHREADSmax}
export APRUN_SNOWANL="${APRUN_default} --cpus-per-task=${NTHREADS_SNOWANL}"

Expand Down
6 changes: 2 additions & 4 deletions env/S4.env
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ if [[ "${step}" = "prep" ]] || [[ "${step}" = "prepbufr" ]]; then
export sys_tp="S4"
export launcher_PREP="srun"

elif [[ "${step}" = "prepsnowobs" ]]; then

export APRUN_CALCFIMS="${APRUN_default}"

elif [[ "${step}" = "prep_emissions" ]]; then

export APRUN="${APRUN_default}"
Expand Down Expand Up @@ -99,6 +95,8 @@ elif [[ "${step}" = "prepobsaero" ]]; then

elif [[ "${step}" = "snowanl" ]]; then

export APRUN_CALCFIMS="${launcher} -n 1"

export NTHREADS_SNOWANL=${NTHREADSmax}
export APRUN_SNOWANL="${APRUN_default}"

Expand Down
6 changes: 2 additions & 4 deletions env/WCOSS2.env
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ if [[ "${step}" = "prep" ]] || [[ "${step}" = "prepbufr" ]]; then
export sys_tp="wcoss2"
export launcher_PREP="mpiexec"

elif [[ "${step}" = "prepsnowobs" ]]; then

export APRUN_CALCFIMS="${APRUN_default}"

elif [[ "${step}" = "prep_emissions" ]]; then

export APRUN="${APRUN_default}"
Expand Down Expand Up @@ -92,6 +88,8 @@ elif [[ "${step}" = "prepobsaero" ]]; then

elif [[ "${step}" = "snowanl" ]]; then

export APRUN_CALCFIMS="${launcher} -n 1"

export NTHREADS_SNOWANL=${NTHREADSmax}
export APRUN_SNOWANL="${APRUN_default}"

Expand Down
6 changes: 3 additions & 3 deletions jobs/JGDAS_ENKF_ECEN
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ export GPREFIX="${GDUMP}.t${gcyc}z."
export GPREFIX_ENS="${GDUMP_ENS}.t${gcyc}z."

RUN=${RUN/enkf} YMD=${PDY} HH=${cyc} declare_from_tmpl -rx \
COM_ATMOS_ANALYSIS_DET:COM_ATMOS_ANALYSIS_TMPL
COMIN_ATMOS_ANALYSIS_DET:COM_ATMOS_ANALYSIS_TMPL

MEMDIR="ensstat" YMD=${PDY} HH=${cyc} declare_from_tmpl -rx \
COM_ATMOS_ANALYSIS_STAT:COM_ATMOS_ANALYSIS_TMPL
COMOUT_ATMOS_ANALYSIS_STAT:COM_ATMOS_ANALYSIS_TMPL

MEMDIR="ensstat" RUN=${GDUMP} YMD=${gPDY} HH=${gcyc} declare_from_tmpl -rx \
COM_ATMOS_HISTORY_STAT_PREV:COM_ATMOS_HISTORY_TMPL
COMIN_ATMOS_HISTORY_STAT_PREV:COM_ATMOS_HISTORY_TMPL


###############################################################
Expand Down
Loading

0 comments on commit 6f00478

Please sign in to comment.