Skip to content

Commit

Permalink
Bring in @DusanJovic-NOAA trap changes
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianCurtis-NOAA committed Apr 30, 2024
1 parent d7fcb15 commit 557a41c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 1 addition & 7 deletions tests/rt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ handle_error() {

rt_trap() {
echo "rt.sh: Exited abnormally, killing workflow and cleaning up"
trap "" SIGINT
[[ ${ROCOTO:-false} == true ]] && rocoto_kill
[[ ${ECFLOW:-false} == true ]] && ecflow_kill
cleanup
Expand Down Expand Up @@ -686,13 +687,6 @@ case ${MACHINE_ID} in
module load ecflow/5.6.0.13
fi
module load intel/19.1.3.304 python/3.8.6
#if [[ "${ECFLOW:-false}" == true ]] ; then
#export ECF_OUTPUTDIR="${PATHRT}/ecf_outputdir"
#export ECF_COMDIR="${PATHRT}/ecf_comdir"
#rm -rf "${ECF_OUTPUTDIR}" "${ECF_COMDIR}"
#mkdir -p "${ECF_OUTPUTDIR}"
#mkdir -p "${ECF_COMDIR}"
#fi
export colonifnco=":output" # hack

DISKNM="/lfs/h2/emc/nems/noscrub/emc.nems/RT"
Expand Down
12 changes: 9 additions & 3 deletions tests/rt_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ if [[ "$0" = "${BASH_SOURCE[0]}" ]]; then
exit 1
fi

ECFLOW_RUNNING=false

# Note: this file must only contain subroutines, and variables that
# are not dependent on the caller. Most regression test variables
# (such as ACCNR) are not set until after rt.sh sources this file.
Expand Down Expand Up @@ -668,6 +670,8 @@ ecflow_run() {
echo "rt_utils.sh: ecflow_server is not running on ${ECF_HOST}:${ECF_PORT}"
echo "rt_utils.sh: attempting to start ecflow_server..."

save_traps=$(trap)
trap "" SIGINT # Ignore INT signal during ecflow startup
if [[ ${MACHINE_ID} == wcoss2 || ${MACHINE_ID} == acorn ]]; then
#shellcheck disable=SC2029
ssh "${ECF_HOST}" "bash -l -c \"module load ecflow && ${ECFLOW_START} -p ${ECF_PORT}\""
Expand All @@ -677,6 +681,8 @@ ecflow_run() {
else
${ECFLOW_START} -p "${ECF_PORT}" -d "${RUNDIR_ROOT}/ecflow_server"
fi
ECFLOW_RUNNING=true
eval "${save_traps}"
# Try pinging ecflow server now, and erroring out if not there.
set +e
ecflow_client --ping --host="${ECF_HOST}" --port="${ECF_PORT}"
Expand All @@ -689,9 +695,9 @@ ecflow_run() {
fi
else
echo "rt_utils.sh: Confirmed: ecflow_server is running on ${ECF_HOST}:${ECF_PORT}"
ECFLOW_RUNNING=true
fi

ECFLOW_RUNNING=true
echo "rt_utils.sh: Starting ECFLOW tasks..."
set +e
ecflow_client --load="${ECFLOW_RUN}/${ECFLOW_SUITE}.def" --host="${ECF_HOST}" --port="${ECF_PORT}"
Expand Down Expand Up @@ -742,14 +748,14 @@ ecflow_stop() {
set +e
SUITES=$( ecflow_client --get )
SUITES=$( grep "^suite" <<< "${SUITES}" )
echo "SUITES=${SUITES}"
if [[ -z "${SUITES}" ]]; then
echo "rt_utils.sh: No other suites running, stopping ecflow_server"
ecflow_client --halt=yes
ecflow_client --check_pt
ecflow_client --terminate=yes
else
echo "rt_utils.sh: Potential suites running, NOT stopping ecflow_server..."
echo "rt_utils.sh: Active suites running, NOT stopping ecflow_server..."
echo "SUITES are: ${SUITES}"
fi
set -e
}

0 comments on commit 557a41c

Please sign in to comment.