forked from ufs-community/ufs-srweather-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[develop] Update wrapper scripts (ufs-community#883)
The wrapper scripts are a set of scripts that run the tasks from a SRW experiment. They are used in a situation where rocoto is not installed or available to use. These set of wrapper scripts have become outdated and don't work in its current state. This PR was created to address this issue. --------- Co-authored-by: Edward Snyder <Edward.Snyder@noaa.com> Co-authored-by: Eddie Snyder <esnyder@derecho2.hsn.de.hpc.ucar.edu>
- Loading branch information
1 parent
3cfe4c9
commit dfc1aef
Showing
15 changed files
with
131 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# This is a pbs job card for the srw_ftest.sh script | ||
# and is called by the wrapper_srw_ftest.sh script | ||
# | ||
#PBS -N srw_ftest_run | ||
#PBS -A ${SRW_PROJECT} | ||
#PBS -q main | ||
#PBS -l select=1:ncpus=24:mpiprocs=24:ompthreads=1 | ||
#PBS -l walltime=00:30:00 | ||
#PBS -V | ||
#PBS -o log_wrap.%j.log | ||
#PBS -e err_wrap.%j.err | ||
|
||
bash ${WORKSPACE}/.cicd/scripts/srw_ftest.sh |
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,16 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# This is a sbatch job card for the srw_ftest.sh script | ||
# and is called by the srw_ftest_wrapper.sh script | ||
# | ||
#SBATCH --job-name=wrapper_test | ||
#SBATCH --account=${SRW_PROJECT} | ||
#SBATCH --qos=batch | ||
#SBATCH --nodes=1 | ||
#SBATCH --tasks-per-node=24 | ||
#SBATCH --cpus-per-task=1 | ||
#SBATCH -t 00:30:00 | ||
#SBATCH -o log_wrap.%j.log | ||
#SBATCH -e err_wrap.%j.err | ||
|
||
bash ${WORKSPACE}/.cicd/scripts/srw_ftest.sh |
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,66 @@ | ||
#!/usr/bin/env bash | ||
|
||
############################ | ||
# | ||
# This is a wrapper script for the srw_ftest.sh script. It was created so we can | ||
# test all of the wrapper script tasks within the Jenkins pipeline. It determines which | ||
# workflow manager is installed on the platform and calls the apprioprate job card: | ||
# sbatch: sbatch_srw_ftest.sh | ||
# pbs: qsub_srw_ftest.sh | ||
########################### | ||
|
||
# Set workflow cmd | ||
declare workflow_cmd | ||
declare arg_1 | ||
if [[ "${SRW_PLATFORM}" == cheyenne ]] || [[ "${SRW_PLATFORM}" == derecho ]]; then | ||
workflow_cmd=qsub | ||
arg_1="" | ||
check_job="qstat -u ${USER} -r ${job_id}" | ||
else | ||
workflow_cmd=sbatch | ||
arg_1="--parsable" | ||
check_job="squeue -u ${USER} -j ${job_id} --noheader" | ||
fi | ||
|
||
# Customize wrapper scripts | ||
if [[ "${SRW_PLATFORM}" == gaea ]]; then | ||
sed -i '15i #SBATCH --clusters=c4' ${WORKSPACE}/.cicd/scripts/${workflow_cmd}_srw_ftest.sh | ||
sed -i 's|qos=batch|qos=windfall|g' ${WORKSPACE}/.cicd/scripts/${workflow_cmd}_srw_ftest.sh | ||
fi | ||
|
||
# Call job card and return job_id | ||
echo "Running: ${workflow_cmd} -A ${SRW_PROJECT} ${arg_1} ${WORKSPACE}/.cicd/scripts/${workflow_cmd}_srw_ftest.sh" | ||
job_id=$(${workflow_cmd} -A ${SRW_PROJECT} ${arg_1} ${WORKSPACE}/.cicd/scripts/${workflow_cmd}_srw_ftest.sh) | ||
|
||
echo "Waiting ten seconds for node to initialize" | ||
sleep 10 | ||
|
||
# Check for job and exit when done | ||
while true | ||
do | ||
job_id_info=$($check_job) | ||
if [ ! -z "$job_id_info" ]; then | ||
echo "Job is still running. Check again in two minutes" | ||
sleep 120 | ||
else | ||
echo "Job has completed." | ||
|
||
# Return exit code and check for results file first | ||
results_file="${WORKSPACE}/functional_test_results_${SRW_PLATFORM}_${SRW_COMPILER}.txt" | ||
if [ ! -f "$results_file" ]; then | ||
echo "Missing results file! \nexit 1" | ||
exit 1 | ||
fi | ||
|
||
# Set exit code to number of failures | ||
set +e | ||
failures=$(grep ": FAIL" ${results_file} | wc -l) | ||
if [[ $failures -ne 0 ]]; then | ||
failures=1 | ||
fi | ||
|
||
set -e | ||
echo "exit ${failures}" | ||
exit ${failures} | ||
fi | ||
done |
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 |
---|---|---|
@@ -1,10 +1,13 @@ | ||
#!/bin/sh | ||
export GLOBAL_VAR_DEFNS_FP="${EXPTDIR}/var_defns.sh" | ||
set -x | ||
set -xa | ||
source ${GLOBAL_VAR_DEFNS_FP} | ||
export CDATE=${DATE_FIRST_CYCL} | ||
export CYCLE_DIR=${EXPTDIR}/${CDATE} | ||
export cyc=${DATE_FIRST_CYCL:8:2} | ||
export PDY=${DATE_FIRST_CYCL:0:8} | ||
export SLASH_ENSMEM_SUBDIR="" | ||
export NWGES_DIR=${NWGES_BASEDIR}/${DATE_FIRST_CYCL:0:8} | ||
|
||
${JOBSdir}/JREGIONAL_MAKE_ICS | ||
|
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,10 +1,14 @@ | ||
#!/bin/sh | ||
export GLOBAL_VAR_DEFNS_FP="${EXPTDIR}/var_defns.sh" | ||
set -x | ||
set -xa | ||
source ${GLOBAL_VAR_DEFNS_FP} | ||
export CDATE=${DATE_FIRST_CYCL} | ||
export CYCLE_DIR=${EXPTDIR}/${CDATE} | ||
export cyc=${DATE_FIRST_CYCL:8:2} | ||
export PDY=${DATE_FIRST_CYCL:0:8} | ||
export SLASH_ENSMEM_SUBDIR="" | ||
|
||
export NWGES_DIR=${NWGES_BASEDIR}/${DATE_FIRST_CYCL:0:8} | ||
export bcgrp="00" | ||
export bcgrpnum="1" | ||
${JOBSdir}/JREGIONAL_MAKE_LBCS | ||
|
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