Skip to content

Commit

Permalink
removed scripts used for getting system defaults and added top level …
Browse files Browse the repository at this point in the history
…CMakeLists.txt to use PROJECT_SOURCE_DIR for HOMEgfs in templiting bash wrapper sripts
  • Loading branch information
Terry McGuinness committed Jan 10, 2025
1 parent 53b13e3 commit 4ee8d81
Show file tree
Hide file tree
Showing 11 changed files with 109 additions and 137 deletions.
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)
111 changes: 0 additions & 111 deletions ci/ctests/CMakeLists.txt

This file was deleted.

80 changes: 80 additions & 0 deletions ctests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
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()

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)
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}
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}
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}
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"
)
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ TEST_NAME=${1:?"Name of the test is required"}
YAML_FILE=${2:?"Name of the CI yaml file for the test"}

# CMake to fill these variables
HOMEgfs="@GW_BASELINE_DIR@"
HOMEgfs="@PROJECT_SOURCE_DIR@"
RUNTESTS="@RUNTESTS@"
ICSDIR_ROOT="@ICSDIR_ROOT@"
HPC_ACCOUNT="@HPC_ACCOUNT@"
Expand Down
22 changes: 0 additions & 22 deletions ci/ctests/scripts/stage.py → ctests/scripts/stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from argparse import ArgumentParser
from pathlib import Path
from wxflow import Configuration, AttrDict, parse_j2yaml, Logger, logit, which, CommandNotFoundError, ProcessError, FileHandler
from workflow.hosts import Host

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

Expand All @@ -26,33 +25,12 @@ def parse_args():
"""
parser = ArgumentParser(description=description)

parser.add_argument('--build_dir', help='CMake build directory', required=False, type=Path, default=None)
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 = AttrDict(HOMEgfs=_top)
data.update(os.environ)

# Initialize host and platform configuration for getting PATH to staged data per machine
host = Host()
cfg = Configuration(f'{data.HOMEgfs}/ci/platforms')
platform_config = cfg.parse_config(f'config.{host.machine.lower()}')
data.update(platform_config)

#pr_case_cfg = parse_j2yaml(path=pr_case_yaml_path, data=data)
#data["PDY"]=str(pr_case_cfg.arguments.idate)[0:8]
#data["HH"]=str(pr_case_cfg.arguments.idate)[8:10]

# TODO get idate in lue of above
idate = "2021032312"

data["PDY"]=str(idate)[0:8]
data["HH"]=str(idate)[8:10]
data["RUNTESTS"]=Path.joinpath(args.build_dir,"RUNTESTS")
data["TEST_NAME"]=args.yaml.stem
case_cfg = parse_j2yaml(path=args.yaml, data=data)
FileHandler(case_cfg.input_files).sync()
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -ux
TEST_NAME=${1:?"Name of the test is required"}

# CMake to fill these variables
HOMEgfs="@GW_BASELINE_DIR@"
HOMEgfs="@PROJECT_SOURCE_DIR@"

# Load the runtime environment for this script (needs wxflow and its dependencies)
set +x
Expand Down
File renamed without changes.
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

0 comments on commit 4ee8d81

Please sign in to comment.