Skip to content

Commit 6a336f8

Browse files
authored
[v2.1.2-1.7] bump VERSION to v2.1.2 and add a workaround for err_exit (NOAA-EMC#985)
* bump version to v2.1.2 * add a workaround for err_exit * address the linter comments
1 parent 10aa8a3 commit 6a336f8

3 files changed

Lines changed: 76 additions & 1 deletion

File tree

sorc/_workaround_/err_exit

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/bin/bash
2+
# shellcheck disable=all
3+
4+
# SCRIPT NAME: err_exit
5+
#
6+
# ABSTRACT: This script is to be used when a fatal error or condition
7+
# has been reached and you want to terminate the job.
8+
#
9+
# USAGE: To use this script one must export the following variables to the
10+
# script: jobid, SENDECF, pgm, pgmout, DATA. One can provide
11+
# a message for the logfile by passing it to the script as an argument.
12+
13+
msg1=${@:-Job $jobid failed}
14+
if [ -n "$pgm" ]; then
15+
msg1+=", ERROR IN $pgm"
16+
fi
17+
if [ -n "$err" ]; then
18+
msg1+=" RETURN CODE $err"
19+
fi
20+
21+
msg2="
22+
-------------------------------------------------------------
23+
-- FATAL ERROR: $msg1
24+
-- ABNORMAL EXIT at $(date) on $HOSTNAME
25+
-------------------------------------------------------------
26+
"
27+
28+
>&2 echo "$msg2"
29+
30+
# list loaded modules
31+
module list
32+
>&2 echo ""
33+
34+
>&2 echo "$msg1"
35+
36+
# list files in temporary working directory
37+
if [ -n "$DATA" ]; then
38+
>&2 echo $DATA
39+
>&2 ls -ltr $DATA
40+
else
41+
>&2 echo "WARNING: DATA variable not defined"
42+
fi
43+
44+
# save standard output
45+
if [ -n "$pgmout" ]; then
46+
if [ -s errfile ]; then
47+
echo "----- contents of errfile -----" >> $pgmout
48+
cat errfile >> $pgmout
49+
fi
50+
>&2 cat $pgmout
51+
elif [ -s errfile ]; then
52+
>&2 cat errfile
53+
fi
54+
55+
# Write to ecflow log:
56+
if [ "$SENDECF" = "YES" ]; then
57+
timeout 30 ecflow_client --msg "$ECF_NAME: $msg1"
58+
timeout 30 ssh $ECF_HOST "echo \"$msg2\" >> ${ECF_JOBOUT:?}"
59+
fi
60+
61+
# KILL THE JOB:
62+
if [ "$SENDECF" = "YES" ]; then
63+
ecflow_client --kill=${ECF_NAME:?}
64+
fi
65+
66+
if [ ! -z $PBS_JOBID ]; then
67+
qdel $PBS_JOBID
68+
elif [ ! -z $SLURM_JOB_ID ]; then
69+
scancel $SLURM_JOB_ID
70+
echo "----- waiting for $SLURM_JOB_ID to be killed -----"
71+
sleep 600
72+
fi

workflow/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v2.1.1
1+
v2.1.2

workflow/sideload/launch.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ fi
118118
module load "prod_util/${MACHINE}"
119119
module list
120120
set -x
121+
# workaround for err_exit, https://github.com/NOAA-EMC/NCEPLIBS-prod_util/pull/73
122+
export PATH=${HOMErrfs}/sorc/_workaround_:${PATH}
123+
121124
# check whether prod_util is correctly loaded
122125
if [[ "${NDATE}" == "" ]]; then
123126
echo "FATAL ERROR: ${NDATE} is not defined; prod_util is not loaded!"

0 commit comments

Comments
 (0)