From 6fccca2960e3cecbe5f46ffacc0a4a73b8e642d4 Mon Sep 17 00:00:00 2001 From: sutt <sutt@cern.ch> Date: Thu, 27 May 2021 18:50:26 +0200 Subject: [PATCH 1/5] Add a script to work out the last valid release When the "targetting" release is incremented, too often these day, the release manger annoyingly simply don't bother to create the newer version of the old targetting release. This script tests the expected version and goes backwards until it finds an actual release that exists. --- .../TrigInDetValidation/CMakeLists.txt | 2 ++ .../python/TrigInDetArtSteps.py | 6 ++-- .../TrigInDetValidation/scripts/getrelease.sh | 36 +++++++++++++++++++ 3 files changed, 40 insertions(+), 4 deletions(-) create mode 100755 Trigger/TrigValidation/TrigInDetValidation/scripts/getrelease.sh diff --git a/Trigger/TrigValidation/TrigInDetValidation/CMakeLists.txt b/Trigger/TrigValidation/TrigInDetValidation/CMakeLists.txt index 5a172162f96a..dbe15d77c7b5 100644 --- a/Trigger/TrigValidation/TrigInDetValidation/CMakeLists.txt +++ b/Trigger/TrigValidation/TrigInDetValidation/CMakeLists.txt @@ -19,3 +19,5 @@ atlas_add_test( TrigValSteeringUT SCRIPT trigvalsteering-unit-tester.py ${CMAKE_CURRENT_SOURCE_DIR}/test PROPERTIES TIMEOUT 600 POST_EXEC_SCRIPT nopost.sh ) + +atlas_install_scripts( scripts/getrelease.sh ) \ No newline at end of file diff --git a/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py b/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py index 5fc6fa611fde..f91f94a8fdc8 100644 --- a/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py +++ b/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py @@ -8,6 +8,7 @@ The main common check steps are defined in the TrigValSteering.CheckSteps module ''' import os +import subprocess import json from TrigValTools.TrigValSteering.ExecStep import ExecStep @@ -133,10 +134,7 @@ class TrigInDetReco(ExecStep): if ( DVERSION is None ) : AVERSION = "22.0.20" else: - BASE=DVERSION[:5] - SUB=int(DVERSION[5:]) - SUB -= 1 - AVERSION=BASE+str(SUB) + AVERSION=str(subprocess.Popen(["getrelease.sh",DVERSION],stdout=subprocess.PIPE).communicate()[0],'utf-8') else: AVERSION = self.release self.args += ' --asetup "RAWtoESD:Athena,'+AVERSION+'" "ESDtoAOD:Athena,'+AVERSION+'" ' diff --git a/Trigger/TrigValidation/TrigInDetValidation/scripts/getrelease.sh b/Trigger/TrigValidation/TrigInDetValidation/scripts/getrelease.sh new file mode 100755 index 000000000000..217929a45280 --- /dev/null +++ b/Trigger/TrigValidation/TrigInDetValidation/scripts/getrelease.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +[ $# -lt 1 ] && exit -1 + +RELEASE=$1 + +SUB=$(echo $RELEASE | sed 's|.*\.||g') +STUB=$(echo $RELEASE | sed 's|\.[^\.]*$||g') + +# echo "$STUB $SUB" + +((SUB--)) + +RELEASE=$STUB.$SUB + +# echo "$1 -> $RELEASE" + + +export AtlasSetup=/afs/cern.ch/atlas/software/dist/AtlasSetup + +[ -z "${ATLAS_LOCAL_ROOT_BASE}" ] && export ATLAS_LOCAL_ROOT_BASE=/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase + +OK=0 + +while [ $SUB -gt 0 ]; do + + # echo "RELEASE: $RELEASE" + + ( source $AtlasSetup/scripts/asetup.sh Athena,$RELEASE --simulate &> /dev/null ) && echo $RELEASE && exit 0 + + ((SUB--)) + + RELEASE=$STUB.$SUB + +done + -- GitLab From f6272723517b5190e0659c715bf7779c5818ba48 Mon Sep 17 00:00:00 2001 From: sutt <sutt@cern.ch> Date: Thu, 27 May 2021 18:56:28 +0200 Subject: [PATCH 2/5] readd excluded changes --- .../TrigInDetValidation/scripts/getrelease.sh | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Trigger/TrigValidation/TrigInDetValidation/scripts/getrelease.sh b/Trigger/TrigValidation/TrigInDetValidation/scripts/getrelease.sh index 217929a45280..c36006519187 100755 --- a/Trigger/TrigValidation/TrigInDetValidation/scripts/getrelease.sh +++ b/Trigger/TrigValidation/TrigInDetValidation/scripts/getrelease.sh @@ -7,24 +7,15 @@ RELEASE=$1 SUB=$(echo $RELEASE | sed 's|.*\.||g') STUB=$(echo $RELEASE | sed 's|\.[^\.]*$||g') -# echo "$STUB $SUB" - ((SUB--)) RELEASE=$STUB.$SUB -# echo "$1 -> $RELEASE" - - export AtlasSetup=/afs/cern.ch/atlas/software/dist/AtlasSetup [ -z "${ATLAS_LOCAL_ROOT_BASE}" ] && export ATLAS_LOCAL_ROOT_BASE=/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase -OK=0 - -while [ $SUB -gt 0 ]; do - - # echo "RELEASE: $RELEASE" +while [ $SUB -ge 0 ]; do ( source $AtlasSetup/scripts/asetup.sh Athena,$RELEASE --simulate &> /dev/null ) && echo $RELEASE && exit 0 @@ -34,3 +25,4 @@ while [ $SUB -gt 0 ]; do done +exit -1 -- GitLab From 1f235f2cddf9be17fa3e36d20567f7df2c11d6e0 Mon Sep 17 00:00:00 2001 From: sutt <sutt@cern.ch> Date: Sat, 29 May 2021 11:54:39 +0200 Subject: [PATCH 3/5] Fix test for last release - use already configured atlas setup Don;t try to setup the atlas code base etc before testing to see whether the requested releases actually exist - use the release that is already setup, or do nothing otherwise --- .../TrigInDetValidation/python/TrigInDetArtSteps.py | 2 ++ .../TrigValidation/TrigInDetValidation/scripts/getrelease.sh | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py b/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py index f91f94a8fdc8..cd81b054a0c6 100644 --- a/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py +++ b/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py @@ -135,6 +135,8 @@ class TrigInDetReco(ExecStep): AVERSION = "22.0.20" else: AVERSION=str(subprocess.Popen(["getrelease.sh",DVERSION],stdout=subprocess.PIPE).communicate()[0],'utf-8') + if AVERSION == "": + AVERSION=DVERSION else: AVERSION = self.release self.args += ' --asetup "RAWtoESD:Athena,'+AVERSION+'" "ESDtoAOD:Athena,'+AVERSION+'" ' diff --git a/Trigger/TrigValidation/TrigInDetValidation/scripts/getrelease.sh b/Trigger/TrigValidation/TrigInDetValidation/scripts/getrelease.sh index c36006519187..66107b57e090 100755 --- a/Trigger/TrigValidation/TrigInDetValidation/scripts/getrelease.sh +++ b/Trigger/TrigValidation/TrigInDetValidation/scripts/getrelease.sh @@ -11,9 +11,7 @@ STUB=$(echo $RELEASE | sed 's|\.[^\.]*$||g') RELEASE=$STUB.$SUB -export AtlasSetup=/afs/cern.ch/atlas/software/dist/AtlasSetup - -[ -z "${ATLAS_LOCAL_ROOT_BASE}" ] && export ATLAS_LOCAL_ROOT_BASE=/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase +[ -z "$AtlasSetup" ] && echo $RELEASE && exit -1 while [ $SUB -ge 0 ]; do -- GitLab From d2d770bf5c588f18f69344c3d4a2c15389897953 Mon Sep 17 00:00:00 2001 From: sutt <sutt@cern.ch> Date: Sat, 29 May 2021 11:56:41 +0200 Subject: [PATCH 4/5] Use current release if atlas code not configured --- .../TrigValidation/TrigInDetValidation/scripts/getrelease.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Trigger/TrigValidation/TrigInDetValidation/scripts/getrelease.sh b/Trigger/TrigValidation/TrigInDetValidation/scripts/getrelease.sh index 66107b57e090..5cfd6fc1ffa7 100755 --- a/Trigger/TrigValidation/TrigInDetValidation/scripts/getrelease.sh +++ b/Trigger/TrigValidation/TrigInDetValidation/scripts/getrelease.sh @@ -4,6 +4,8 @@ RELEASE=$1 +[ -z "$AtlasSetup" ] && echo $RELEASE && exit -1 + SUB=$(echo $RELEASE | sed 's|.*\.||g') STUB=$(echo $RELEASE | sed 's|\.[^\.]*$||g') @@ -11,8 +13,6 @@ STUB=$(echo $RELEASE | sed 's|\.[^\.]*$||g') RELEASE=$STUB.$SUB -[ -z "$AtlasSetup" ] && echo $RELEASE && exit -1 - while [ $SUB -ge 0 ]; do ( source $AtlasSetup/scripts/asetup.sh Athena,$RELEASE --simulate &> /dev/null ) && echo $RELEASE && exit 0 -- GitLab From f125c265e5a404342bb229d8e5a23bfa31b58671 Mon Sep 17 00:00:00 2001 From: sutt <sutt@cern.ch> Date: Sat, 29 May 2021 12:17:32 +0200 Subject: [PATCH 5/5] tedious python error handling --- .../python/TrigInDetArtSteps.py | 15 ++++++++++----- .../TrigInDetValidation/scripts/getrelease.sh | 4 +++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py b/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py index cd81b054a0c6..4b9fa3d988df 100644 --- a/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py +++ b/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py @@ -123,10 +123,9 @@ class TrigInDetReco(ExecStep): chains += ']' self.preexec_trig = 'doEmptyMenu=True;'+flags+'selectChains='+chains - - if (self.release == 'current'): - print( "Using current release for offline Reco steps " ) - else: + + AVERSION = "" + if (self.release != 'current'): # get the current atlas base release, and the previous base release import os DVERSION=os.getenv('Athena_VERSION') @@ -136,11 +135,17 @@ class TrigInDetReco(ExecStep): else: AVERSION=str(subprocess.Popen(["getrelease.sh",DVERSION],stdout=subprocess.PIPE).communicate()[0],'utf-8') if AVERSION == "": - AVERSION=DVERSION + print( "cannot get last stable release - will use current release" ) else: AVERSION = self.release + + # would use AVERSION is not None, but the return from a shell function with no printout + # gets set as an empty string rather than None + if AVERSION != "": self.args += ' --asetup "RAWtoESD:Athena,'+AVERSION+'" "ESDtoAOD:Athena,'+AVERSION+'" ' print( "remapping athena base release version for offline Reco steps: ", DVERSION, " -> ", AVERSION ) + else: + print( "Using current release for offline Reco steps " ) self.args += ' --preExec "RDOtoRDOTrigger:{:s};" "all:{:s};" "RAWtoESD:{:s};" "ESDtoAOD:{:s};"'.format( diff --git a/Trigger/TrigValidation/TrigInDetValidation/scripts/getrelease.sh b/Trigger/TrigValidation/TrigInDetValidation/scripts/getrelease.sh index 5cfd6fc1ffa7..8593b33df1d5 100755 --- a/Trigger/TrigValidation/TrigInDetValidation/scripts/getrelease.sh +++ b/Trigger/TrigValidation/TrigInDetValidation/scripts/getrelease.sh @@ -1,10 +1,12 @@ #!/bin/bash +exit -1 + [ $# -lt 1 ] && exit -1 RELEASE=$1 -[ -z "$AtlasSetup" ] && echo $RELEASE && exit -1 +[ -z "$AtlasSetup" ] && exit -1 SUB=$(echo $RELEASE | sed 's|.*\.||g') STUB=$(echo $RELEASE | sed 's|\.[^\.]*$||g') -- GitLab