Commit 1fdfc004 authored by Andrea Sciaba's avatar Andrea Sciaba
Browse files

Adapted to latest CE-sft-job

parent 508457b7
......@@ -22,6 +22,7 @@
. $SAME_SENSOR_HOME/config.sh
test $SAME_CE_CONFIG && test -e $SAME_CE_CONFIG && . $SAME_CE_CONFIG
log="CE-sft-job.log"
......@@ -55,57 +56,78 @@ if [ "x$1" == "x--publish" ] ; then
RETCODE=$SAME_OK
age=$((`date +%s` - `stat -c %Y testjob.jid`))
jobStatus=`$JOB_STATUS_CMD -i testjob.jid | grep "^Current Status:" | sed -e "s/Current Status:\s*//" -e "s/\s*$//"`
if [ -e testjob.out ] ; then
cat $log
echo "<h2>Job output:</h2>"
echo "<pre>"
cat testjob.out
echo "</pre>"
grep -q "Problem unpacking SAM Framework" testjob.out
if [ $? -eq 0 ] ; then
echo "summary: Problem unpacking SAM Framework on WN"
RETCODE=$SAME_ERROR
fi
rm -f testjob.out testjob.jid
exit $RETCODE
fi
JOBSTATUS=$(mktemp jobstatus-$$-XXXX)
$JOB_STATUS_CMD -i testjob.jid > $JOBSTATUS
jobStatus=`grep "^Current Status:" $JOBSTATUS | sed -e "s/Current Status:\s*//" -e "s/\s*$//"`
if [ \( "$jobStatus" == "Submitted" -o "$jobStatus" == "Waiting" -o "$jobStatus" == "Ready" \) -a $age -ge 21600 ] ; then
status=$SAME_WARNING
cat $log
echo "<h2>Job status:</h2>"
echo "<pre>"
cat $JOBSTATUS
echo "</pre>"
echo "<h2>Job stuck with logging info:</h2>"
echo "<pre>"
$JOB_LOGGING_INFO_CMD -i testjob.jid > testjob.log
cat testjob.log
echo "</pre>"
echo "summary: STUCK"
rm -f testjob.out testjob.jid
exit $status
RETCODE=$SAME_NOTICE
rm -f testjob.jid $JOBSTATUS
exit $RETCODE
fi
if [ "$jobStatus" == "Aborted" ] ; then
status=$SAME_ERROR
cat $log
echo "<h2>Job status:</h2>"
echo "<pre>"
cat $JOBSTATUS
echo "</pre>"
echo "<h2>Job failed with logging info:</h2>"
echo "<pre>"
$JOB_LOGGING_INFO_CMD -i testjob.jid > testjob.log
cat testjob.log
echo "</pre>"
if grep "BrokerHelper: no compatible resources" testjob.log > /dev/null 2>&1 ; then
echo "summary: LISTMATCHFAILED"
elif grep "the user proxy expired (job is still running)" testjob.log > /dev/null 2>&1 ; then
if egrep "Reason.*request expired" testjob.log > /dev/null 2>&1 ; then
if egrep "Reason.*BrokerHelper: no compatible resources" testjob.log > /dev/null 2>&1 ; then
echo "summary: LISTMATCHFAILED"
RETCODE=$SAME_ERROR
else
echo "summary: Check WMS"
RETCODE=$SAME_NOTICE
fi
elif egrep "the user proxy expired (job is still running)" testjob.log > /dev/null 2>&1 ; then
echo "summary: PROXYEXPIRED"
status=$SAME_WARNING
RETCODE=$SAME_WARNING
else
echo "summary: FAILED"
echo "summary: FAILED"
RETCODE=$SAME_ERROR
fi
rm -f testjob.out testjob.jid
exit $status
fi
if [ -e testjob.out ] ; then
cat $log
echo "<h2>Job output:</h2>"
echo "<pre>"
cat testjob.out
echo "</pre>"
grep -q "Problem unpacking SAM Framework" testjob.out
if [ $? -eq 0 ] ; then
echo "summary: Problem unpacking SAM Framework on WN"
RETCODE=$SAME_ERROR
fi
rm -f testjob.out testjob.jid
rm -f testjob.jid $JOBSTATUS
exit $RETCODE
fi
rm -f $JOBSTATUS
exit 0
else
if [ -e testjob.jid ] ; then
......@@ -149,7 +171,7 @@ else
echo "Job submission failed! Check the Resource Broker" >> $log
echo "summary: RBError" >> $log
cat $log
exit $SAME_WARNING
exit $SAME_NOTICE
fi
exit 0
fi
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment