From 04bc45a55d0d60a25199713a7bbf285f1ad5980b Mon Sep 17 00:00:00 2001
From: Rafal Bielski <rafal.bielski@cern.ch>
Date: Wed, 3 Jul 2019 09:28:18 +0000
Subject: [PATCH] Improvements in Trigger ART exec scripts

---
 .../test/exec_TrigUpgradeTest_art_athenaMT.sh             | 5 +++++
 .../TrigUpgradeTest/test/exec_TrigUpgradeTest_art_post.sh | 6 +++---
 .../TrigValTools/bin/chainDumpWorkaround.sh               | 8 ++++++++
 .../TriggerTest/test/exec_art_triggertest_post.sh         | 6 +++---
 .../test/exec_athena_art_trigger_validation.sh            | 5 +++++
 5 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/Trigger/TrigValidation/TrigUpgradeTest/test/exec_TrigUpgradeTest_art_athenaMT.sh b/Trigger/TrigValidation/TrigUpgradeTest/test/exec_TrigUpgradeTest_art_athenaMT.sh
index 188a5c16ae2..446b18be6bf 100755
--- a/Trigger/TrigValidation/TrigUpgradeTest/test/exec_TrigUpgradeTest_art_athenaMT.sh
+++ b/Trigger/TrigValidation/TrigUpgradeTest/test/exec_TrigUpgradeTest_art_athenaMT.sh
@@ -84,6 +84,11 @@ fi
 
 ######################################
 
+# Generate empty PoolFileCatalog.xml - this prevents incorrect handling of crashes on the grid
+art.py createpoolfile
+
+######################################
+
 if [[ ${FROMPICKLE} == "1" ]]; then
   echo "Running athena from pickle file ${JOBOPTION} with the command:"
   (set -x
diff --git a/Trigger/TrigValidation/TrigUpgradeTest/test/exec_TrigUpgradeTest_art_post.sh b/Trigger/TrigValidation/TrigUpgradeTest/test/exec_TrigUpgradeTest_art_post.sh
index d082757eca0..470f1d7b0d6 100755
--- a/Trigger/TrigValidation/TrigUpgradeTest/test/exec_TrigUpgradeTest_art_post.sh
+++ b/Trigger/TrigValidation/TrigUpgradeTest/test/exec_TrigUpgradeTest_art_post.sh
@@ -78,7 +78,7 @@ timeout 5m check_log.pl --config checklogTrigUpgradeTest.conf --showexcludestats
 echo "art-result: ${PIPESTATUS[0]} CheckLog"
 
 echo $(date "+%FT%H:%M %Z")"     Running checklog for warnings"
-timeout 5m check_log.pl --config checklogTrigUpgradeTest.conf --noerrors --warnings --showexcludestats ${JOB_LOG} 2>&1 | tee warnings.log
+timeout 5m check_log.pl --config checklogTrigUpgradeTest.conf --noerrors --warnings --showexcludestats ${JOB_LOG} >warnings.log 2>&1
 
 ### PERFMON
 
@@ -91,7 +91,7 @@ fi
 
 if [ -f expert-monitoring.root ]; then
   echo $(date "+%FT%H:%M %Z")"     Running histSizes"
-  timeout 5m histSizes.py -t expert-monitoring.root 2>&1 | tee histSizes.log
+  timeout 5m histSizes.py -t expert-monitoring.root >histSizes.log 2>&1
 fi
 
 ### MAKE LOG TAIL FILE
@@ -119,7 +119,7 @@ mv ${REGTESTREF_BASENAME} ${REGTESTREF_BASENAME}.new
 
 if [ -f ${REF_FOLDER}/expert-monitoring.root ]; then
   echo $(date "+%FT%H:%M %Z")"     Running rootcomp"
-  timeout 10m rootcomp.py --skip="TIME_" ${REF_FOLDER}/expert-monitoring.root expert-monitoring.root 2>&1 | tee rootcompout.log
+  timeout 10m rootcomp.py --skip="TIME_" ${REF_FOLDER}/expert-monitoring.root expert-monitoring.root >rootcompout.log 2>&1
   echo "art-result: ${PIPESTATUS[0]} RootComp"
 else
   echo $(date "+%FT%H:%M %Z")"     No reference expert-monitoring.root found in ${REF_FOLDER}"
diff --git a/Trigger/TrigValidation/TrigValTools/bin/chainDumpWorkaround.sh b/Trigger/TrigValidation/TrigValTools/bin/chainDumpWorkaround.sh
index 58400bd4e88..08132c9beed 100755
--- a/Trigger/TrigValidation/TrigValTools/bin/chainDumpWorkaround.sh
+++ b/Trigger/TrigValidation/TrigValTools/bin/chainDumpWorkaround.sh
@@ -20,20 +20,28 @@ fi
 #
 rootScript="TFile f(\"$histFile\"); \
 TH2* h2d=(TH2*)f.Get(\"TrigSteer_HLT/SignatureAcceptance\"); \
+if (!h2d) exit(1); \
 int biny=h2d->GetYaxis()->FindBin(\"Output\"); \
 TH1* h1d=(TH1*)h2d->ProjectionX(\"\",biny,biny); \
 for (int i=0; i<=h1d->GetNbinsX(); ++i) {int num=h1d->GetBinContent(i); printf(\"%s %d\\n\",h1d->GetXaxis()->GetBinLabel(i),num);}"
 
 root -b -l -q -e "${rootScript}" | grep 'HLT_' | sort > HLTChain.txt
+if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
+  echo "WARNING Failed to extract HLTChain counts from ${histFile}"
+fi
 
 #
 # Total number of events
 #
 rootScript="TFile f(\"$histFile\"); \
 TH2* h2d=(TH2*)f.Get(\"TrigSteer_HLT/SignatureAcceptance\"); \
+if (!h2d) exit(1); \
 int binx=h2d->GetXaxis()->FindBin(\"All\"); \
 int biny=h2d->GetYaxis()->FindBin(\"L1\"); \
 printf(\"%d\\n\",(int)h2d->GetBinContent(binx,biny));"
 
 root -b -l -q -e "${rootScript}" | grep -v '^$' > TotalEventsProcessed.txt
+if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
+  echo "WARNING Failed to extract TotalEventsProcessed from ${histFile}"
+fi
 
diff --git a/Trigger/TrigValidation/TriggerTest/test/exec_art_triggertest_post.sh b/Trigger/TrigValidation/TriggerTest/test/exec_art_triggertest_post.sh
index de2f79ad92b..b78ca98d689 100755
--- a/Trigger/TrigValidation/TriggerTest/test/exec_art_triggertest_post.sh
+++ b/Trigger/TrigValidation/TriggerTest/test/exec_art_triggertest_post.sh
@@ -43,7 +43,7 @@ timeout 5m check_log.pl --config checklogTriggerTest.conf --showexcludestats ${J
 echo "art-result: ${PIPESTATUS[0]} CheckLog"
 
 echo $(date "+%FT%H:%M %Z")"     Running checklog for warnings"
-timeout 5m check_log.pl --config checklogTriggerTest.conf --noerrors --warnings --showexcludestats ${JOB_LOG} 2>&1 | tee warnings.log
+timeout 5m check_log.pl --config checklogTriggerTest.conf --noerrors --warnings --showexcludestats ${JOB_LOG} >warnings.log 2>&1
 
 ### PERFMON
 
@@ -53,7 +53,7 @@ timeout 5m perfmon.py -f 0.90 ntuple.pmon.gz
 ### HISTOGRAM COUNT
 
 echo $(date "+%FT%H:%M %Z")"     Running histSizes"
-timeout 5m histSizes.py -t expert-monitoring.root 2>&1 | tee histSizes.log
+timeout 5m histSizes.py -t expert-monitoring.root >histSizes.log 2>&1
 
 ### CHAINDUMP
 
@@ -82,7 +82,7 @@ mv athena.regtest athena.regtest.new
 
 if [ -f ${REF_FOLDER}/expert-monitoring.root ]; then
   echo $(date "+%FT%H:%M %Z")"     Running rootcomp"
-  timeout 10m rootcomp.py ${REF_FOLDER}/expert-monitoring.root expert-monitoring.root 2>&1 | tee rootcompout.log
+  timeout 10m rootcomp.py ${REF_FOLDER}/expert-monitoring.root expert-monitoring.root >rootcompout.log 2>&1
   echo "art-result: ${PIPESTATUS[0]} RootComp"
   echo $(date "+%FT%H:%M %Z")"     Running checkcounts"
   timeout 10m trigtest_checkcounts.sh 0 expert-monitoring.root ${REF_FOLDER}/expert-monitoring.root HLT 2>&1 | tee checkcountout.log
diff --git a/Trigger/TrigValidation/TriggerTest/test/exec_athena_art_trigger_validation.sh b/Trigger/TrigValidation/TriggerTest/test/exec_athena_art_trigger_validation.sh
index 562ca5aaf48..13c772a88d8 100755
--- a/Trigger/TrigValidation/TriggerTest/test/exec_athena_art_trigger_validation.sh
+++ b/Trigger/TrigValidation/TriggerTest/test/exec_athena_art_trigger_validation.sh
@@ -59,6 +59,11 @@ fi
 
 ######################################
 
+# Generate empty PoolFileCatalog.xml - this prevents incorrect handling of crashes on the grid
+art.py createpoolfile
+
+######################################
+
 echo "Running athena command:"
 if [[ $INPUT == 'data' ]]; then
   (set -x
-- 
GitLab