Skip to content
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

CI JJOB Tests using CMake #3214

Draft
wants to merge 117 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
987ae5b
added ctest dir with cmake to create an experment
Dec 6, 2024
61fcf83
added CMakeLists for creating initial case EXPDIR usint ctest
Dec 6, 2024
f5f6595
ready to test getting the job names
Dec 6, 2024
cbe3bab
move all operations of creating EXPDIR cases into configure phase
Dec 6, 2024
6a50e14
got cmake configure to work for EXPDIR
Dec 6, 2024
bcebeca
can not do both file and variable save for execute_process
Dec 6, 2024
be7a890
working cmake config up to output of job names
Dec 6, 2024
2811629
Merge branch 'NOAA-EMC:develop' into ctest_jjobs_framework
TerrenceMcGuinness-NOAA Dec 9, 2024
70a8183
loop over jobnames and create an experment for each
Dec 9, 2024
72e5a9c
update JOB name update in loop
Dec 9, 2024
1f1fcd6
addded debug outputs
Dec 9, 2024
ee27b02
modifying plslot list to be only on a per case
Dec 9, 2024
bc76ddf
filter pslot list for only relevent cases
Dec 9, 2024
38838a6
refining get_job_names
Dec 9, 2024
d18ad01
modigied get_jobs_names to task and metatask names
Dec 9, 2024
ef0e066
got better jobname parcer working
Dec 9, 2024
519a919
Merge branch 'NOAA-EMC:develop' into ctest_jjobs_framework
TerrenceMcGuinness-NOAA Dec 9, 2024
f813a1b
replaced generate_workflows with create_experment
Dec 10, 2024
8238228
removed non-existing ENVIRONMENT setting to consolated COMMAND line
Dec 10, 2024
bf579ee
got cmake script to use creat_experiment
Dec 10, 2024
28ef1af
Merge branch 'NOAA-EMC:develop' into ctest_jjobs_framework
TerrenceMcGuinness-NOAA Dec 12, 2024
374927f
just getting started with addeding a ctest
Dec 12, 2024
8b4fc4f
add in test for configured project
Dec 12, 2024
ce37d86
added ctest and testing
Dec 12, 2024
d4e3266
Merge branch 'NOAA-EMC:develop' into ctest_jjobs_framework
TerrenceMcGuinness-NOAA Dec 13, 2024
bb12cda
moved ctests dir to top HOMEgfs/ci/ctests with its own scripts dir
Dec 13, 2024
f78181c
added all jobs for tests for each case
Dec 13, 2024
46cddb7
added data stagging dependances and started it as a stub script
Dec 14, 2024
d6c3a49
Merge branch 'NOAA-EMC:develop' into ctest_jjobs_framework
TerrenceMcGuinness-NOAA Dec 16, 2024
434f869
added driver for creating ctests from yaml files
Dec 18, 2024
99df88d
added a driver to create ctests from defintions in yaml files
Dec 18, 2024
e186173
added final step to loop over yaml files for creating functiona ctest…
Dec 18, 2024
c4a2780
Merge branch 'NOAA-EMC:develop' into ctest_jjobs_framework
TerrenceMcGuinness-NOAA Dec 19, 2024
0183667
added second yaml case file for testing python driver
Dec 19, 2024
3088bff
added a few comments for each section
Dec 19, 2024
9d06df7
Merge branch 'NOAA-EMC:develop' into ctest_jjobs_framework
TerrenceMcGuinness-NOAA Dec 20, 2024
674f8d6
made CMakeList.txt independent of python script
Dec 20, 2024
68ca6ee
simplified CMakeList to be compatible with manin build, consolated cr…
Dec 20, 2024
f7bbd40
repurposed python script for generating args to man CMakeLists.txt
Dec 20, 2024
36d497e
added lables to run tests in groups and added stubbed scripts
Dec 20, 2024
808a4cf
created script and cases dir to isolate CMakeLists.txt
Dec 20, 2024
81e640f
renamed test to create_experiment
Dec 20, 2024
a1d0f20
missed update to name of test from test_ to create_experiment_
Dec 20, 2024
2cbf4ee
forgot to save contents of the stubbed scripts
Dec 20, 2024
687217f
spelling error on create_experiment
Dec 20, 2024
55766bd
got a few hints on using File Utils directly in case Yaml file
Dec 20, 2024
f69fb68
updated adding functional test as line enteries in CMakeLists.txt dir…
Dec 23, 2024
3cc83c6
Cleaned up names to have Case and job name first
Dec 23, 2024
e1e1858
added file utils copy commands in gfs_fcst for C48_ATM
Dec 23, 2024
5ce988f
started on stage data python script
Dec 24, 2024
cefaccd
added exec line for python staging script
Dec 24, 2024
bec03d9
deleted space in yaml file for copy commands
Dec 24, 2024
5f9451b
Merge branch 'NOAA-EMC:develop' into ctest_jjobs_framework
TerrenceMcGuinness-NOAA Dec 26, 2024
74fbf45
removed extra $ on JOB var
Jan 2, 2025
19600f1
idate needed for PDY
Jan 2, 2025
2caa229
updated stage data with idate for PDY and HH and made sure paths wher…
Jan 2, 2025
749e54f
added copy using FIleHandler
Jan 2, 2025
75450e1
copy command needs quotes
Jan 2, 2025
0fc5d76
added sync() on file handler
Jan 2, 2025
ea01737
got FileUtil to work in stage data
Jan 2, 2025
e9c46f1
got started on execute
Jan 2, 2025
2602166
execute needed shabang and exit 0
Jan 2, 2025
1950af4
almost ready to launch execute.sh
Jan 2, 2025
c691c0e
Merge branch 'NOAA-EMC:develop' into ctest_jjobs_framework
TerrenceMcGuinness-NOAA Jan 3, 2025
276a9bd
added working skeleton bash script for execute using rocotoboot with …
Jan 3, 2025
283000e
added a few ICs that where missed
Jan 3, 2025
b2a6fec
removed extra scripts no longer used
Jan 3, 2025
9525c74
added defulted values and over rides from command line
Jan 3, 2025
74f7268
removed HOMEgfs for path to create expermient
Jan 3, 2025
5cd1c5f
removed another unused script
Jan 3, 2025
c132786
fixed a few path errors with HOMEgfs still hanging around
Jan 3, 2025
87674f2
Merge branch 'NOAA-EMC:develop' into ctest_jjobs_framework
TerrenceMcGuinness-NOAA Jan 6, 2025
e873722
added cmake_parse_arguments with extras and used inline template for …
Jan 6, 2025
32c5f87
added template for cmake tests setup.sh
Jan 6, 2025
128d0e6
had to add ARG_ header to labels names for depenancies for setup worked
Jan 6, 2025
abb2952
added bash wrapper to stage_data.py and made single job per yaml conf…
Jan 6, 2025
1d54caf
added the part to drop in templated inline script for stage.sh
Jan 6, 2025
2532576
getting stage.sh.in args to work for now
Jan 6, 2025
0967f10
still getting args straintened out with staging
Jan 6, 2025
8231519
added args in bash wrapper to stage.py to pick up ARG_CASE and ARG_JOB
Jan 7, 2025
30466b9
updated args to stage.py to simply take yaml input
Jan 7, 2025
3deeb41
had extra ) for updated add_test
Jan 7, 2025
099a2cb
removed reading of pr case file for getting idate
Jan 7, 2025
94dd64e
replaced JOB_CASE in path for inputs to TEST_NAME
Jan 7, 2025
a98d55d
updated path to yaml input to stage
Jan 7, 2025
29517e3
ctest dir is ctests in path to YAML file for stage.py
Jan 7, 2025
60a6136
finilized inputs to make stage.py to work without using CASE+JOB
Jan 7, 2025
b977e52
mnissed a couple or ARGS_ again this time in execute
Jan 7, 2025
95be9f2
ARG are prefixes in execute add test
Jan 7, 2025
e9b0b6a
ARG are prefixes in execute add test 2
Jan 7, 2025
a72827c
ARG are prefixes in execute add test 3
Jan 7, 2025
4f010a4
added MAKE_CURRENT_BINARY_DIR as templated VAR in stage
Jan 7, 2025
b79d445
made execute bash sript a template too
Jan 7, 2025
16cd19f
forgot to save CMakeLists now has updated call to excute from script …
Jan 7, 2025
fffb13d
last bug for working execute phase
Jan 7, 2025
5c5ac0f
ready to test x coders add for waiting for slurm job to complete
Jan 7, 2025
06c8e8f
do not need link to wxflow anymore, added it to PYTHONPATH in bash wr…
Jan 7, 2025
edde418
Merge branch 'NOAA-EMC:develop' into ctest_jjobs_framework
TerrenceMcGuinness-NOAA Jan 8, 2025
d68b02e
path to wxflow in PYTHONPATH was wrong in stage template
Jan 8, 2025
b0602bc
generlized ARG over-ride and added check for exectution success from …
Jan 8, 2025
30b3f3a
should have checked for End not END for success
Jan 8, 2025
42084e7
oops need done at then of loop in execute bash sript
Jan 8, 2025
8d71151
removed C48_S2SW.yaml for functional test as it is not ready yet
Jan 8, 2025
cf7be28
working on shellnorms
Jan 8, 2025
a49a642
working on more shellnorms
Jan 8, 2025
466831d
working on even more shellnorms
Jan 8, 2025
2d18461
working couple more shellnorms
Jan 8, 2025
53b13e3
Merge branch 'NOAA-EMC:develop' into ctest_jjobs_framework
TerrenceMcGuinness-NOAA Jan 10, 2025
4ee8d81
removed scripts used for getting system defaults and added top level …
Jan 10, 2025
b3518ca
added to yaml fun conf file to us jinja string modification TEST_DATE
Jan 10, 2025
54f633b
typos in CMakeLists and module file for adding CMake on Orion
Jan 10, 2025
a182c44
added TEST_DATE as an agrment to adding a test in CMake List file
Jan 10, 2025
fd8a8bc
needed idate in arg to exexcute
Jan 11, 2025
472d89c
just use par_yaml
Jan 11, 2025
45d2901
trying to get args into yaml
Jan 11, 2025
8ca4d7a
added TEST_DATA via data to template
Jan 11, 2025
91d76e3
added TEST_DATE into arg to bash stage
Jan 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# ------------------------------------------------------------------------- #
# Global Workflow
# ------------------------------------------------------------------------- #

# Check for minimum cmake requirement
cmake_minimum_required( VERSION 3.20 FATAL_ERROR )

project(global_workflow VERSION 1.0.0)

include(GNUInstallDirs)
enable_testing()

# Build type.
if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$")
message(STATUS "Setting build type to 'Release' as none was specified.")
set(CMAKE_BUILD_TYPE
"Release"
CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo")
endif()

# Build global-workflow source codes
# add_subdirectory(sorc)

# Setup tests
add_subdirectory(ctests)
2 changes: 2 additions & 0 deletions ci/platforms/config.hera
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

export GFS_CI_ROOT=/scratch1/NCEPDEV/global/Terry.McGuinness/GFS_CI_ROOT
export ICSDIR_ROOT=/scratch1/NCEPDEV/global/glopara/data/ICSDIR

export STAGED_FUNCTIONAL_TEST_DIR=${GFS_CI_ROOT}/STAGED_FUNCTIONAL_TEST_DIR
export HPC_ACCOUNT=nems
export max_concurrent_cases=5
export max_concurrent_pr=4
Expand Down
1 change: 1 addition & 0 deletions ci/platforms/config.orion
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
export GFS_CI_ROOT=/work2/noaa/stmp/GFS_CI_ROOT/ORION
export ICSDIR_ROOT=/work/noaa/global/glopara/data/ICSDIR
export HPC_ACCOUNT=nems
export STAGED_FUNCTIONAL_TEST_DIR=/work/noaa/stmp/GFS_CI_ROOT/ORION/STAGED_FUNCTIONAL_TEST_DIR
export max_concurrent_cases=5
export max_concurrent_pr=4

Expand Down
89 changes: 89 additions & 0 deletions ctests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
if (NOT DEFINED HOMEgfs)
set(HOMEgfs ${PROJECT_SOURCE_DIR})
endif()

if (DEFINED ENV{RUNTESTS} AND NOT DEFINED RUNTESTS)
set(RUNTESTS $ENV{RUNTESTS} CACHE FILEPATH "Path to global-workflow RUNTESTS directory")
else()
set(RUNTESTS ${CMAKE_CURRENT_BINARY_DIR}/RUNTESTS)
endif()

if (DEFINED ENV{HPC_ACCOUNT} AND NOT DEFINED HPC_ACCOUNT)
set(HPC_ACCOUNT $ENV{HPC_ACCOUNT} CACHE STRING "Local location of glowbal-workflow initialconditions")
endif()

if (NOT DEFINED HPC_ACCOUNT)
message(FATAL_ERROR "HPC_ACCOUNT must be set")
return()
endif()

if (DEFINED ENV{ISCDIR_ROOT} AND NOT DEFINED ICSDIR_ROOT)
set(ICSDIR_ROOT $ENV{HPC_ACCOUNT} CACHE STRING "Local path to global-workflow initialconditions")
endif()
if(NOT DEFINED ICSDIR_ROOT)
message(FATAL_ERROR "ICSDIR_ROOT must be set")
return()
endif()

if (DEFINED ENV{STAGED_FUNCTIONAL_TEST_DIR} AND NOT DEFINED STAGED_FUNCTIONAL_TEST_DIR)
set(STAGED_FUNCTIONAL_TEST_DIR $ENV{STAGED_FUNCTIONAL_TEST_DIR} CACHE STRING "Local path to global-workflow staged data for functional test")
endif()
if(NOT DEFINED STAGED_FUNCTIONAL_TEST_DIR)
message(FATAL_ERROR "STATED_FUNCTIONAL_TEST_DIR must be set")
return()
endif()

message(STATUS "MACHINE_ID: '${MACHINE_ID}'")
message(STATUS "gw: global-workflow baselines will be used from: '${HOMEgfs}'")
message(STATUS "gw: global-workflow tests will be run at: '${RUNTESTS}'")
message(STATUS "gw: global-workflow tests will use the allocation: '${HPC_ACCOUNT}'")
message(STATUS "gw: global-workflow tests will use ICSDIR_ROOT: '${ICSDIR_ROOT}'")

# Prepare test scripts
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/setup.sh.in
${CMAKE_CURRENT_BINARY_DIR}/scripts/setup.sh @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/stage.sh.in
${CMAKE_CURRENT_BINARY_DIR}/scripts/stage.sh @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/execute.sh.in
${CMAKE_CURRENT_BINARY_DIR}/scripts/execute.sh @ONLY)

function(AddJJOBTest)

set(prefix ARG)
set(novals NOTRAPFPE NOVALGRIND)
set(singlevals CASE JOB TEST_DATE)
set(multivals TEST_DEPENDS)

cmake_parse_arguments(${prefix}
"${novals}" "${singlevals}" "${multivals}"
${ARGN})

set(TEST_NAME ${ARG_CASE}_${ARG_JOB})
set(CASE_PATH ${HOMEgfs}/ci/cases/pr)
set(CASE_YAML ${CASE_PATH}/${ARG_CASE}.yaml)

add_test(NAME test_${TEST_NAME}_setup
COMMAND ./setup.sh ${TEST_NAME} ${CASE_YAML} ${ARG_TEST_DATE}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/scripts)
set_tests_properties(test_${TEST_NAME}_setup PROPERTIES LABELS "${ARG_CASE};${ARG_JOB}")

add_test(NAME test_${TEST_NAME}_stage
COMMAND ./stage.sh ${TEST_NAME} ${ARG_TEST_DATE}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/scripts)
set_tests_properties(test_${TEST_NAME}_stage PROPERTIES DEPENDS test_${TEST_NAME}_setup LABELS "${ARG_CASE};${ARG_JOB}")

add_test(NAME test_${TEST_NAME}_execute
COMMAND ./execute.sh ${TEST_NAME} ${ARG_JOB} ${ARG_TEST_DATE}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/scripts)
set_tests_properties(test_${TEST_NAME}_execute PROPERTIES DEPENDS test_${TEST_NAME}_stage LABELS "${ARG_CASE};${ARG_JOB}")

add_test(NAME test_${TEST_NAME}_validate
COMMAND bash -c "${GW_BASELINE_DIR}/ci/ctests/scripts/validate.sh ${TEST_NAME}")
set_tests_properties(test_${TEST_NAME}_validate PROPERTIES DEPENDS test_${TEST_NAME}_execute LABELS "${ARG_CASE};${ARG_JOB}")
endfunction()

AddJJOBTest(
CASE "C48_ATM"
JOB "gfs_fcst_seg0"
TEST_DATE "2021032312"
)
17 changes: 17 additions & 0 deletions ctests/cases/C48_ATM_gfs_fcst_seg0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
input_files:
mkdir:
- "{{ 'RUNTESTS' | getenv }}/COMROOT/{{ 'TEST_NAME' | getenv }}//gfs.{{TEST_DATE | to_YMD}}/{{TEST_DATE | strftime('%H')}}/model/atmos/input"
copy:
- ["{{ 'STAGED_FUNCTIONAL_TEST' | getenv }}/{{ 'TEST_NAME' | getenv }}/gfs.{{ TEST_DATE | to_YMD }}/{{ TEST_DATE | strftime('%H') }}/model/atmos/input/gfs_ctrl.nc", "{{ 'RUNTESTS' | getenv }}/COMROOT/{{ 'TEST_NAME' | getenv }}//gfs.{{TEST_DATE | to_YMD}}/{{TEST_DATE | strftime('%H')}}/model/atmos/input/gfs_ctrl.nc"]
- ["{{ 'STAGED_FUNCTIONAL_TEST' | getenv }}/{{ 'TEST_NAME' | getenv }}/gfs.{{ TEST_DATE | to_YMD }}/{{ TEST_DATE | strftime('%H') }}/model/atmos/input/gfs_data.tile1.nc", "{{ 'RUNTESTS' | getenv }}/COMROOT/{{ 'TEST_NAME' | getenv }}//gfs.{{TEST_DATE | to_YMD}}/{{TEST_DATE | strftime('%H')}}/model/atmos/input/gfs_data.tile1.nc"]
- ["{{ 'STAGED_FUNCTIONAL_TEST' | getenv }}/{{ 'TEST_NAME' | getenv }}/gfs.{{ TEST_DATE | to_YMD }}/{{ TEST_DATE | strftime('%H') }}/model/atmos/input/gfs_data.tile2.nc", "{{ 'RUNTESTS' | getenv }}/COMROOT/{{ 'TEST_NAME' | getenv }}//gfs.{{TEST_DATE | to_YMD}}/{{TEST_DATE | strftime('%H')}}/model/atmos/input/gfs_data.tile2.nc"]
- ["{{ 'STAGED_FUNCTIONAL_TEST' | getenv }}/{{ 'TEST_NAME' | getenv }}/gfs.{{ TEST_DATE | to_YMD }}/{{ TEST_DATE | strftime('%H') }}/model/atmos/input/gfs_data.tile3.nc", "{{ 'RUNTESTS' | getenv }}/COMROOT/{{ 'TEST_NAME' | getenv }}/gfs.{{TEST_DATE | to_YMD}}/{{TEST_DATE | strftime('%H')}}/model/atmos/input/gfs_data.tile3.nc"]
- ["{{ 'STAGED_FUNCTIONAL_TEST' | getenv }}/{{ 'TEST_NAME' | getenv }}/gfs.{{ TEST_DATE | to_YMD }}/{{ TEST_DATE | strftime('%H') }}/model/atmos/input/gfs_data.tile4.nc", "{{ 'RUNTESTS' | getenv }}/COMROOT/{{ 'TEST_NAME' | getenv }}//gfs.{{TEST_DATE | to_YMD}}/{{TEST_DATE | strftime('%H')}}/model/atmos/input/gfs_data.tile4.nc"]
- ["{{ 'STAGED_FUNCTIONAL_TEST' | getenv }}/{{ 'TEST_NAME' | getenv }}/gfs.{{ TEST_DATE | to_YMD }}/{{ TEST_DATE | strftime('%H') }}/model/atmos/input/gfs_data.tile5.nc", "{{ 'RUNTESTS' | getenv }}/COMROOT/{{ 'TEST_NAME' | getenv }}///gfs.{{TEST_DATE | to_YMD}}/{{TEST_DATE | strftime('%H')}}/model/atmos/input/gfs_data.tile5.nc"]
- ["{{ 'STAGED_FUNCTIONAL_TEST' | getenv }}/{{ 'TEST_NAME' | getenv }}/gfs.{{ TEST_DATE | to_YMD }}/{{ TEST_DATE | strftime('%H') }}/model/atmos/input/gfs_data.tile6.nc", "{{ 'RUNTESTS' | getenv }}/COMROOT/{{ 'TEST_NAME' | getenv }}/gfs.{{TEST_DATE | to_YMD}}/{{TEST_DATE | strftime('%H')}}/model/atmos/input/gfs_data.tile6.nc"]
- ["{{ 'STAGED_FUNCTIONAL_TEST' | getenv }}/{{ 'TEST_NAME' | getenv }}/gfs.{{ TEST_DATE | to_YMD }}/{{ TEST_DATE | strftime('%H') }}/model/atmos/input/sfc_data.tile1.nc", "{{ 'RUNTESTS' | getenv }}/COMROOT/{{ 'TEST_NAME' | getenv }}/gfs.{{TEST_DATE | to_YMD}}/{{TEST_DATE | strftime('%H')}}/model/atmos/input/sfc_data.tile1.nc"]
- ["{{ 'STAGED_FUNCTIONAL_TEST' | getenv }}/{{ 'TEST_NAME' | getenv }}/gfs.{{ TEST_DATE | to_YMD }}/{{ TEST_DATE | strftime('%H') }}/model/atmos/input/sfc_data.tile2.nc", "{{ 'RUNTESTS' | getenv }}/COMROOT/{{ 'TEST_NAME' | getenv }}/gfs.{{TEST_DATE | to_YMD}}/{{TEST_DATE | strftime('%H')}}/model/atmos/input/sfc_data.tile2.nc"]
- ["{{ 'STAGED_FUNCTIONAL_TEST' | getenv }}/{{ 'TEST_NAME' | getenv }}/gfs.{{ TEST_DATE | to_YMD }}/{{ TEST_DATE | strftime('%H') }}/model/atmos/input/sfc_data.tile3.nc", "{{ 'RUNTESTS' | getenv }}/COMROOT/{{ 'TEST_NAME' | getenv }}/gfs.{{TEST_DATE | to_YMD}}/{{TEST_DATE | strftime('%H')}}/model/atmos/input/sfc_data.tile3.nc"]
- ["{{ 'STAGED_FUNCTIONAL_TEST' | getenv }}/{{ 'TEST_NAME' | getenv }}/gfs.{{ TEST_DATE | to_YMD }}/{{ TEST_DATE | strftime('%H') }}/model/atmos/input/sfc_data.tile4.nc", "{{ 'RUNTESTS' | getenv }}/COMROOT/{{ 'TEST_NAME' | getenv }}/gfs.{{TEST_DATE | to_YMD}}/{{TEST_DATE | strftime('%H')}}/model/atmos/input/sfc_data.tile4.nc"]
- ["{{ 'STAGED_FUNCTIONAL_TEST' | getenv }}/{{ 'TEST_NAME' | getenv }}/gfs.{{ TEST_DATE | to_YMD }}/{{ TEST_DATE | strftime('%H') }}/model/atmos/input/sfc_data.tile5.nc", "{{ 'RUNTESTS' | getenv }}/COMROOT/{{ 'TEST_NAME' | getenv }}/gfs.{{TEST_DATE | to_YMD}}/{{TEST_DATE | strftime('%H')}}/model/atmos/input/sfc_data.tile5.nc"]
- ["{{ 'STAGED_FUNCTIONAL_TEST' | getenv }}/{{ 'TEST_NAME' | getenv }}/gfs.{{ TEST_DATE | to_YMD }}/{{ TEST_DATE | strftime('%H') }}/model/atmos/input/sfc_data.tile6.nc", "{{ 'RUNTESTS' | getenv }}/COMROOT/{{ 'TEST_NAME' | getenv }}/gfs.{{TEST_DATE | to_YMD}}/{{TEST_DATE | strftime('%H')}}/model/atmos/input/sfc_data.tile6.nc"]
62 changes: 62 additions & 0 deletions ctests/scripts/execute.sh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/env bash

set -xe

TEST_NAME=${1:?"Name of the test is required"}
JOB=${2:?"Job name is required"}
# TODO - adding idate by hand for now, need to get this from the test somehow
idate=$3

#TODO - add rocotoboot_dryrun to repo some how
rocotoboot_dryrun=/work2/noaa/global/mterry/rocoto_dryrun/bin/rocotoboot
CASEDIR="@CMAKE_CURRENT_BINARY_DIR@/RUNTESTS/EXPDIR/${TEST_NAME}"
cd "${CASEDIR}"
rm -f ./*.db
rm -f ./jobcard

job_card=$(yes | "${rocotoboot_dryrun}" -d "${TEST_NAME}.db" -w "${TEST_NAME}.xml" -v 10 -c "${idate}00" -t "${JOB}" 2> jobcard) || true

Check warning

Code scanning / shellcheck

job_card appears unused. Verify use (or export if used externally). Warning

job_card appears unused. Verify use (or export if used externally).
cat jobcard | sed '/^{{\|^}}/d' | sed '1d' > "${TEST_NAME}.sub" || true

Check notice

Code scanning / shellcheck

Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead. Note

Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.

#TODO - Generalize for batch system (hard coded to slurm)

output=$(sbatch "${TEST_NAME}.sub")
job_id=$(echo "${output}" | awk '{print $4}')
echo "Job ${job_id} submitted for test ${TEST_NAME} with job name ${JOB}"
stdout_file=$(scontrol show job "${job_id}" | grep StdOut | awk -F= '{print $2}') || true

# Check the status of the Slurm job
check_stdout_file() {
last_line=$(tail -n 1 "${stdout_file}")
if [[ "${last_line}" == "End"* && "${last_line}" == *"error code 0"* ]]; then
echo "Job ${job_id} completed successfully with END and error code 0."
exit 0
else
echo "Job ${job_id} did not complete successfully. Last line: ${last_line}"
exit 1
fi
}

# Check the status of the Slurm job
timeout=0
TIMEOUT=60
while true; do
job_status=$(squeue --job "${job_id}" --noheader --format "%T")
if [[ "${job_status}" == "COMPLETED" ]]; then
echo "Job ${job_id} completed successfully."
check_stdout_file
elif [[ "${job_status}" == "FAILED" || "${job_status}" == "CANCELLED" || "${job_status}" == "TIMEOUT" ]]; then
echo "Job ${job_id} failed with status: ${job_status}."
exit 1
elif [[ -z "${job_status}" ]]; then
echo "Job ${job_id} is no longer in the queue. Checking stdout file."
check_stdout_file
else
echo "Job ${job_id} is still running with status: ${job_status}."
sleep 60 # Check every 60 seconds
timeout=$((timeout+1))
if [[ "${timeout}" -gt "${TIMEOUT}" ]]; then
echo "Job ${job_id} has been running for more than ${TIMEOUT} minutes. Exiting."
exit 1
fi
fi
done
32 changes: 32 additions & 0 deletions ctests/scripts/setup.sh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

set -ux

TEST_NAME=${1:?"Name of the test is required"}
YAML_FILE=${2:?"Name of the CI yaml file for the test"}
TEST_DATE=${3:?"idate of the test is required"}

Check warning

Code scanning / shellcheck

TEST_DATE appears unused. Verify use (or export if used externally). Warning

TEST_DATE appears unused. Verify use (or export if used externally).

# CMake to fill these variables
HOMEgfs="@PROJECT_SOURCE_DIR@"
RUNTESTS="@RUNTESTS@"
ICSDIR_ROOT="@ICSDIR_ROOT@"
HPC_ACCOUNT="@HPC_ACCOUNT@"

set +x
source "${HOMEgfs}/workflow/gw_setup.sh"
set -x

pslot="${TEST_NAME}" \
RUNTESTS="${RUNTESTS}" \
ICSDIR_ROOT="${ICSDIR_ROOT}" \
HPC_ACCOUNT="${HPC_ACCOUNT}" \
"${HOMEgfs}/workflow/create_experiment.py" --yaml "${YAML_FILE}" --overwrite
rc=$?
if [[ "${rc}" -ne 0 ]]; then
set +x
echo "Failed to create test experiment for '${TEST_NAME}' with yaml file '${YAML_FILE}'"
set -x
exit "${rc}"
fi

exit 0
37 changes: 37 additions & 0 deletions ctests/scripts/stage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env python3

import os, sys
import shutil
_here = os.path.dirname(__file__)
_top = os.path.abspath(os.path.join(os.path.abspath(_here), '../../..'))
sys.path.insert(0, _top)

from argparse import ArgumentParser
from pathlib import Path
from wxflow import parse_j2yaml, FileHandler, AttrDict, Logger

logger = Logger(level=os.environ.get("LOGGING_LEVEL", "DEBUG"), colored_log=False)

def parse_args():
"""
Parse command line arguments.

Returns
-------
argparse.Namespace
The parsed command line arguments.
"""
description = """Arguments for creating and updating error log files
"""
parser = ArgumentParser(description=description)

parser.add_argument('-y', '--yaml', help='full path to yaml file describing the job test configuration', type=Path, required=True)
return parser.parse_args()

if __name__ == '__main__':

# Parse command line arguments
args = parse_args()
data = {'TEST_DATE': os.environ.get('TEST_DATE')}
case_cfg = parse_j2yaml(path=args.yaml, data=data)
FileHandler(case_cfg.input_files).sync()
33 changes: 33 additions & 0 deletions ctests/scripts/stage.sh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

set -ux

TEST_NAME=${1:?"Name of the test is required"}
TEST_DATE=${2:?"idate of the test is required"}

# CMake to fill these variables
STAGED_FUNCTIONAL_TEST_DIR="@STAGED_FUNCTIONAL_TEST_DIR@"

Check warning

Code scanning / shellcheck

STAGED_FUNCTIONAL_TEST_DIR appears unused. Verify use (or export if used externally). Warning

STAGED_FUNCTIONAL_TEST_DIR appears unused. Verify use (or export if used externally).
RUNTESTS="@RUNTESTS@"

Check warning

Code scanning / shellcheck

RUNTESTS appears unused. Verify use (or export if used externally). Warning

RUNTESTS appears unused. Verify use (or export if used externally).

Check warning

Code scanning / shellcheck

RUNTESTS appears unused. Verify use (or export if used externally). Warning

RUNTESTS appears unused. Verify use (or export if used externally).
HOMEgfs="@PROJECT_SOURCE_DIR@"

# Load the runtime environment for this script (needs wxflow and its dependencies)
set +x
source "${HOMEgfs}/workflow/gw_setup.sh"
rc=$?
[[ "${rc}" -ne 0 ]] && exit "${status}"
set -x
PYTHONPATH="${PYTHONPATH:+${PYTHONPATH}:}${HOMEgfs}/sorc/wxflow/src"
export PYTHONPATH

INPUTS_YAML="${HOMEgfs}/ctests/cases/${TEST_NAME}.yaml"

"${HOMEgfs}/ctests/scripts/stage.py" --yaml "${INPUTS_YAML}"
rc=$?
if [[ "${rc}" -ne 0 ]]; then
set +x
echo "Failed to stage inputs for '${TEST_NAME}' with '${INPUTS_YAML}'"
set -x
exit "${rc}"
fi

exit 0
2 changes: 2 additions & 0 deletions ctests/scripts/validate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
echo "This is a stub for the validate script."
2 changes: 2 additions & 0 deletions modulefiles/module_gwsetup.orion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ prepend_path("MODULEPATH", "/work/noaa/epic/role-epic/spack-stack/orion/spack-st

local stack_intel_ver=os.getenv("stack_intel_ver") or "2021.9.0"
local python_ver=os.getenv("python_ver") or "3.11.6"
local cmake_ver=os.getenv("cmake_ver") or "3.23.1"

load(pathJoin("stack-intel", stack_intel_ver))
load(pathJoin("python", python_ver))
load("py-jinja2")
load("py-pyyaml")
load("py-numpy")
load(pathJoin("cmake", cmake_ver))

whatis("Description: GFS run setup environment")
1 change: 0 additions & 1 deletion sorc/gsi_enkf.fd
Submodule gsi_enkf.fd deleted from 27c03e
1 change: 0 additions & 1 deletion sorc/gsi_utils.fd
Submodule gsi_utils.fd deleted from f71601
Loading