Skip to content

Commit

Permalink
streamline run_jedi_exe ctests (#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
RussTreadon-NOAA committed Feb 6, 2023
1 parent 9029966 commit 9dbc973
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 106 deletions.
15 changes: 15 additions & 0 deletions test/atm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,21 @@ if (BUILD_GDASBUNDLE)
ENVIRONMENT "PYTHONPATH=${PROJECT_BINARY_DIR}/ush:$ENV{PYTHONPATH}"
)

# test for ush/run_jedi_exe.py 3dhofx
add_test(NAME test_gdasapp_run_jedi_exe_3dhofx
COMMAND ${PROJECT_SOURCE_DIR}/test/atm/run_jedi_exe_3dhofx.sh ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/test/)

# test for ush/run_jedi_exe.py 3dvar
add_test(NAME test_gdasapp_run_jedi_exe_3dvar
COMMAND ${PROJECT_SOURCE_DIR}/test/atm/run_jedi_exe_3dvar.sh ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/test/)

# test for ush/run_jedi_exe.py letkf
add_test(NAME test_gdasapp_run_jedi_exe_letkf
COMMAND ${PROJECT_SOURCE_DIR}/test/atm/run_jedi_exe_letkf.sh ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/test/)

# Test exgdas scripts from the global-worflow
if (WORKFLOW_TESTS)
add_subdirectory(global-workflow)
Expand Down
19 changes: 0 additions & 19 deletions test/atm/global-workflow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,3 @@ add_test(NAME test_gdasapp_atm_jjob_ens_post
COMMAND ${PROJECT_SOURCE_DIR}/test/atm/global-workflow/jjob_ens_post.sh
${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/test/atm/global-workflow/testrun)

# run_jedi_exe ctests do not require g-w. place here due to longer run time
# test for ush/run_jedi_exe.py 3dhofx
add_test(NAME test_gdasapp_run_jedi_exe_3dhofx
COMMAND ${PROJECT_SOURCE_DIR}/test/atm/global-workflow/run_jedi_exe_3dhofx.sh
${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/test/atm/global-workflow/testrun)

# test for ush/run_jedi_exe.py 3dvar
add_test(NAME test_gdasapp_run_jedi_exe_3dvar
COMMAND ${PROJECT_SOURCE_DIR}/test/atm/global-workflow/run_jedi_exe_3dvar.sh
${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/test/atm/global-workflow/testrun)

# test for ush/run_jedi_exe.py letkf
add_test(NAME test_gdasapp_run_jedi_exe_letkf
COMMAND ${PROJECT_SOURCE_DIR}/test/atm/global-workflow/run_jedi_exe_letkf.sh
${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/test/atm/global-workflow/testrun)
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -x
bindir=$1
srcdir=$2

# Identify machine
if [[ -d /scratch1 ]] ; then
machine="hera"
elif [[ -d /work ]] ; then
Expand All @@ -13,12 +14,14 @@ else
exit 99
fi

# Load modules
set +x
module use ${srcdir}/modulefiles
module load GDAS/${machine}
set -x
module list

# Set machine dependent variables
if [ "$machine" = "hera" ] ; then
partition="hera"
gdasfix="/scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/fix"
Expand All @@ -27,9 +30,11 @@ elif [ "$machine" = "orion" ]; then
gdasfix="/work2/noaa/da/cmartin/GDASApp/fix"
fi

# Create test run directory
mkdir -p ${bindir}/test/atm/global-workflow/testrun/gdas_single_test_hofx3d
cd ${bindir}/test/atm/global-workflow/testrun/gdas_single_test_hofx3d

# Create input yaml
cat > ./3dhofx_example.yaml << EOF
working directory: ./
GDASApp home: ${srcdir}
Expand All @@ -44,9 +49,9 @@ config:
layout_x: 3
layout_y: 2
atm_window_length: PT6H
valid_time: 2021-08-01T00:00:00Z
valid_time: 2021-12-21T06:00:00Z
dump: gdas
case: C768
case: C96
levs: 128
interp_method: barycentric
job options:
Expand All @@ -60,42 +65,39 @@ job options:
modulepath: ${srcdir}/modulefiles
EOF

rm stdout.txt
${srcdir}/ush/run_jedi_exe.py -c ./3dhofx_example.yaml > stdout.txt
# Execute run_jedi_exe.py
if [ -e stdout.txt ]; then
rm -f stdout.txt
fi
${srcdir}/ush/run_jedi_exe.py -c ./3dhofx_example.yaml > stdout.txt 2>&1
rc=$?
if [ $rc -ne 0 ]; then
exit $rc
fi

sleep 10
jobid=$(grep "Submitted" stdout.txt | awk -F' ' '{print $4}')
echo "jobid is $jobid"
# Check for job submission error
error=$(grep -i "error" stdout.txt | wc -l)
if [ $error -ne 0 ]; then
rc=$error
exit $rc
fi

nloop=100
n=1
while [ $n -le $nloop ]; do
if [ -s GDASApp.o$jobid ]; then
break
fi
sleep 10
n=$((n+1))
done
# Cancel submitted job
jobid=$(grep "Submitted" stdout.txt | awk -F' ' '{print $4}')
scancel $jobid
rc=$?
if [ $rc -ne 0 ]; then
exit $rc
fi

rc=1
n=1
while [ $n -le $nloop ]; do
count=$(cat GDASApp.o$jobid | grep "OOPS_STATS Run end" | wc -l)
if [ $count -gt 0 ]; then
rc=0
break
fi
count=$(cat GDASApp.o$jobid | grep "srun: error" | wc -l)
if [ $count -gt 0 ]; then
rc=9
break
# Check for valid yaml files
ylist="3dhofx_example.yaml gdas_hofx.yaml"
for yfile in $ylist; do
python3 -c 'import yaml, sys; yaml.safe_load(sys.stdin)' < $yfile
rc=$?
if [ $rc -ne 0 ]; then
exit $rc
fi
sleep 10
n=$((n+1))
done

exit $rc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -x
bindir=$1
srcdir=$2

# Identify machine
if [[ -d /scratch1 ]] ; then
machine="hera"
elif [[ -d /work ]] ; then
Expand All @@ -13,12 +14,14 @@ else
exit 99
fi

# Load modules
set +x
module use ${srcdir}/modulefiles
module load GDAS/${machine}
set -x
module list

# Set machine dependent variables
if [ "$machine" = "hera" ] ; then
partition="hera"
gdasfix="/scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/fix"
Expand All @@ -27,9 +30,11 @@ elif [ "$machine" = "orion" ]; then
gdasfix="/work2/noaa/da/cmartin/GDASApp/fix"
fi

# Create test run directory
mkdir -p ${bindir}/test/atm/global-workflow/testrun/gdas_single_test_3dvar
cd ${bindir}/test/atm/global-workflow/testrun/gdas_single_test_3dvar

# Create input yaml
cat > ./3dvar_example.yaml << EOF
working directory: ./
GDASApp home: ${srcdir}
Expand Down Expand Up @@ -69,45 +74,39 @@ job options:
modulepath: ${srcdir}/modulefiles
EOF

# Execute run_jedi_exe.py
if [ -e stdout.txt ]; then
rm -f stdout.txt
fi

${srcdir}/ush/run_jedi_exe.py -c ./3dvar_example.yaml > stdout.txt
${srcdir}/ush/run_jedi_exe.py -c ./3dvar_example.yaml > stdout.txt 2>&1
rc=$?
if [ $rc -ne 0 ]; then
exit $rc
fi

sleep 10
jobid=$(grep "Submitted" stdout.txt | awk -F' ' '{print $4}')
echo "jobid is $jobid"
# Check for job submission error
error=$(grep -i "error" stdout.txt | wc -l)
if [ $error -ne 0 ]; then
rc=$error
exit $rc
fi

nloop=100
n=1
while [ $n -le $nloop ]; do
if [ -s GDASApp.o$jobid ]; then
break
fi
sleep 10
n=$((n+1))
done
# Cancel submitted job
jobid=$(grep "Submitted" stdout.txt | awk -F' ' '{print $4}')
scancel $jobid
rc=$?
if [ $rc -ne 0 ]; then
exit $rc
fi

rc=1
n=1
while [ $n -le $nloop ]; do
count=$(cat GDASApp.o$jobid | grep "OOPS_STATS Run end" | wc -l)
if [ $count -gt 0 ]; then
rc=0
break
fi
count=$(cat GDASApp.o$jobid | grep "srun: error" | wc -l)
if [ $count -gt 0 ]; then
rc=9
break
# Check for valid yaml files
ylist="3dvar_example.yaml gdas_variational.yaml"
for yfile in $ylist; do
python3 -c 'import yaml, sys; yaml.safe_load(sys.stdin)' < $yfile
rc=$?
if [ $rc -ne 0 ]; then
exit $rc
fi
sleep 10
n=$((n+1))
done

exit $rc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -x
bindir=$1
srcdir=$2

# Identify machine
if [[ -d /scratch1 ]] ; then
machine="hera"
elif [[ -d /work ]] ; then
Expand All @@ -13,12 +14,14 @@ else
exit 99
fi

# Load modules
set +x
module use ${srcdir}/modulefiles
module load GDAS/${machine}
set -x
module list

# Set machine dependent variables
if [ "$machine" = "hera" ] ; then
cominges="/scratch1/NCEPDEV/da/Russ.Treadon/GDASApp/cases"
partition="hera"
Expand All @@ -29,9 +32,11 @@ elif [ "$machine" = "orion" ]; then
gdasfix="/work2/noaa/da/cmartin/GDASApp/fix"
fi

# Create test run directory
mkdir -p ${bindir}/test/atm/global-workflow/testrun/gdas_single_test_letkf
cd ${bindir}/test/atm/global-workflow/testrun/gdas_single_test_letkf

# Create input yaml
cat > ./letkf_example.yaml << EOF
working directory: ./
GDASApp home: ${srcdir}
Expand Down Expand Up @@ -71,43 +76,39 @@ job options:
modulepath: ${srcdir}/modulefiles
EOF

rm stdout.txt
${srcdir}/ush/run_jedi_exe.py -c ./letkf_example.yaml > stdout.txt
# Execute run_jedi_exe.py
if [ -e stdout.txt ]; then
rm -f stdout.txt
fi
${srcdir}/ush/run_jedi_exe.py -c ./letkf_example.yaml > stdout.txt 2>&1
rc=$?
if [ $rc -ne 0 ]; then
exit $rc
fi

sleep 10
jobid=$(grep "Submitted" stdout.txt | awk -F' ' '{print $4}')
echo "jobid is $jobid"
# Check for job submission error
error=$(grep -i "error" stdout.txt | wc -l)
if [ $error -ne 0 ]; then
rc=$error
exit $rc
fi

nloop=100
n=1
while [ $n -le $nloop ]; do
if [ -s GDASApp.o$jobid ]; then
break
fi
sleep 10
n=$((n+1))
done
# Cancel submitted job
jobid=$(grep "Submitted" stdout.txt | awk -F' ' '{print $4}')
scancel $jobid
rc=$?
if [ $rc -ne 0 ]; then
exit $rc
fi

rc=1
n=1
while [ $n -le $nloop ]; do
count=$(cat GDASApp.o$jobid | grep "OOPS_STATS Run end" | wc -l)
if [ $count -gt 0 ]; then
rc=0
break
fi
count=$(cat GDASApp.o$jobid | grep "srun: error" | wc -l)
if [ $count -gt 0 ]; then
rc=9
break
# Check for valid yaml files
ylist="letkf_example.yaml gdas_letkf.yaml"
for yfile in $ylist; do
python3 -c 'import yaml, sys; yaml.safe_load(sys.stdin)' < $yfile
rc=$?
if [ $rc -ne 0 ]; then
exit $rc
fi
sleep 10
n=$((n+1))
done

exit $rc

0 comments on commit 9dbc973

Please sign in to comment.