Skip to content

Commit d9c4fea

Browse files
Scripts for apass1 of MayJune2022
1 parent 8586190 commit d9c4fea

File tree

7 files changed

+38962
-0
lines changed

7 files changed

+38962
-0
lines changed
Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
#!/bin/bash
2+
3+
# Script to run the async processing
4+
#
5+
# if run locally, you need to export e.g.:
6+
#
7+
# export ALIEN_JDL_LPMRUNNUMBER=505673
8+
# export ALIEN_JDL_LPMINTERACTIONTYPE=pp
9+
# export ALIEN_JDL_LPMPRODUCTIONTAG=OCT
10+
# export ALIEN_JDL_LPMPASSNAME=apass4
11+
# export ALIEN_JDL_LPMANCHORYEAR=2021
12+
13+
14+
if [[ "${1##*.}" == "root" ]]; then
15+
#echo ${1##*.}
16+
#echo "alien://${1}" > list.list
17+
#export MODE="remote"
18+
echo "${1}" > list.list
19+
export MODE="LOCAL"
20+
shift
21+
elif [[ "${1##*.}" == "xml" ]]; then
22+
sed -rn 's/.*turl="([^"]*)".*/\1/p' $1 > list.list
23+
export MODE="remote"
24+
shift
25+
fi
26+
27+
POSITIONAL=()
28+
while [[ $# -gt 0 ]]; do
29+
key="$1"
30+
case $key in
31+
-rnb|--run-number)
32+
RUNNUMBER="$2"
33+
shift
34+
shift
35+
;;
36+
-b|--beam-type)
37+
BEAMTYPE="$2"
38+
shift
39+
shift
40+
;;
41+
-m|--mode)
42+
MODE="$2"
43+
shift
44+
shift
45+
;;
46+
-p|--period)
47+
PERIOD="$2"
48+
shift
49+
shift
50+
;;
51+
-pa|--pass)
52+
PASS="$2"
53+
shift
54+
shift
55+
;;
56+
*)
57+
POSITIONAL+=("$1")
58+
shift
59+
;;
60+
esac
61+
done
62+
63+
# now we overwrite if we found them in the jdl
64+
if [[ -n "$ALIEN_JDL_LPMRUNNUMBER" ]]; then
65+
export RUNNUMBER="$ALIEN_JDL_LPMRUNNUMBER"
66+
fi
67+
68+
# beam type
69+
if [[ -n "$ALIEN_JDL_LPMINTERACTIONTYPE" ]]; then
70+
export BEAMTYPE="$ALIEN_JDL_LPMINTERACTIONTYPE"
71+
fi
72+
73+
# period
74+
if [[ -n "$ALIEN_JDL_LPMPRODUCTIONTAG" ]]; then
75+
export PERIOD="$ALIEN_JDL_LPMPRODUCTIONTAG"
76+
export O2DPGPATH="$PERIOD"
77+
( [[ $ALIEN_JDL_LPMPRODUCTIONTAG == MAY ]] || [[ $ALIEN_JDL_LPMPRODUCTIONTAG == LHC22c ]] ) && O2DPGPATH="MayJunePilotBeam"
78+
fi
79+
80+
# pass
81+
if [[ -n "$ALIEN_JDL_LPMPASSNAME" ]]; then
82+
export PASS="$ALIEN_JDL_LPMPASSNAME"
83+
fi
84+
85+
if [[ -z $RUNNUMBER ]] || [[ -z $PERIOD ]] || [[ -z $BEAMTYPE ]] || [[ -z $PASS ]]; then
86+
echo "check env variables we need RUNNUMBER (--> $RUNNUMBER), PERIOD (--> $PERIOD), PASS (--> $PASS), BEAMTYPE (--> $BEAMTYPE)"
87+
exit 3
88+
fi
89+
90+
echo processing run $RUNNUMBER, from period $PERIOD with $BEAMTYPE collisions and mode $MODE
91+
92+
###if [[ $MODE == "remote" ]]; then
93+
# common archive
94+
if [[ ! -f commonInput.tgz ]]; then
95+
echo "No commonInput.tgz found exiting"
96+
exit 2
97+
fi
98+
tar -xzvf commonInput.tgz
99+
source $O2DPG_ROOT/DATA/production/configurations/$ALIEN_JDL_LPMANCHORYEAR/$O2DPGPATH/$ALIEN_JDL_LPMPASSNAME/selectSettings.sh
100+
# run specific archive
101+
if [[ ! -f runInput_$RUNNUMBER.tgz ]]; then
102+
echo "No runInput_$RUNNUMBER.tgz, let's hope we don't need it"
103+
else
104+
tar -xzvf runInput_$RUNNUMBER.tgz
105+
fi
106+
###fi
107+
108+
echo "Checking current directory content"
109+
ls -altr
110+
111+
# define whether to remap or not the Cluster Dictionaries for ITS and MFT
112+
source $O2DPG_ROOT/DATA/production/configurations/$ALIEN_JDL_LPMANCHORYEAR/$O2DPGPATH/$ALIEN_JDL_LPMPASSNAME/parse.sh `cat list.list`
113+
114+
if [[ -f "setenv_extra.sh" ]]; then
115+
source setenv_extra.sh $RUNNUMBER $BEAMTYPE
116+
else
117+
echo "************************************************************************************"
118+
echo "No ad-hoc setenv_extra settings for current async processing; using the one in O2DPG"
119+
echo "************************************************************************************"
120+
if [[ -f $O2DPG_ROOT/DATA/production/configurations/$ALIEN_JDL_LPMANCHORYEAR/$O2DPGPATH/$ALIEN_JDL_LPMPASSNAME/setenv_extra.sh ]]; then
121+
ln -s $O2DPG_ROOT/DATA/production/configurations/$ALIEN_JDL_LPMANCHORYEAR/$O2DPGPATH/$ALIEN_JDL_LPMPASSNAME/setenv_extra.sh
122+
source setenv_extra.sh $RUNNUMBER $BEAMTYPE
123+
else
124+
echo "*********************************************************************************************************"
125+
echo "No setenev_extra for $ALIEN_JDL_LPMANCHORYEAR/$O2DPGPATH/$ALIEN_JDL_LPMPASSNAME in O2DPG"
126+
echo " No special settings will be used"
127+
echo "*********************************************************************************************************"
128+
fi
129+
fi
130+
131+
rm -f /dev/shm/*
132+
133+
if [[ -f run-workflow-on-inputlist.sh ]]; then
134+
echo "Use run-workflow-on-inputlist.sh macro passed as input"
135+
else
136+
echo "Use run-workflow-on-inputlist.sh macro from O2"
137+
cp $O2_ROOT/prodtests/full-system-test/run-workflow-on-inputlist.sh .
138+
fi
139+
140+
if [[ -z $DPL_WORKFLOW_FROM_OUTSIDE ]]; then
141+
echo "Use dpl-workflow.sh from O2"
142+
cp $O2_ROOT/prodtests/full-system-test/dpl-workflow.sh .
143+
else
144+
echo "Use dpl-workflow.sh passed as input"
145+
cp $DPL_WORKFLOW_FROM_OUTSIDE .
146+
fi
147+
148+
if [[ ! -z $QC_JSON_FROM_OUTSIDE ]]; then
149+
echo "QC json from outside is $QC_JSON_FROM_OUTSIDE"
150+
fi
151+
152+
ln -sf $O2DPG_ROOT/DATA/common/setenv.sh
153+
ln -sf $O2DPG_ROOT/DATA/common/getCommonArgs.sh
154+
ln -sf $O2_ROOT/prodtests/full-system-test/workflow-setup.sh
155+
156+
# reco and matching
157+
# print workflow
158+
IS_SIMULATED_DATA=0 WORKFLOWMODE=print DISABLE_ROOT_OUTPUT="" TFDELAY=40 NTIMEFRAMES=-1 SHMSIZE=16000000000 DDSHMSIZE=32000 ./run-workflow-on-inputlist.sh CTF list.list > workflowconfig.log
159+
# run it
160+
IS_SIMULATED_DATA=0 WORKFLOWMODE=run DISABLE_ROOT_OUTPUT="" TFDELAY=40 NTIMEFRAMES=-1 SHMSIZE=16000000000 DDSHMSIZE=32000 ./run-workflow-on-inputlist.sh CTF list.list
161+
162+
# now extract all performance metrics
163+
IFS=$'\n'
164+
if [[ -f "performanceMetrics.json" ]]; then
165+
for workflow in `grep ': {' performanceMetrics.json`; do
166+
strippedWorkflow=`echo $workflow | cut -d\" -f2`
167+
cat performanceMetrics.json | jq '.'\"${strippedWorkflow}\"'' > ${strippedWorkflow}_metrics.json
168+
done
169+
fi
170+
171+
# now checking AO2D file
172+
if [[ -f "AO2D.root" ]]; then
173+
root -l -b -q $O2DPG_ROOT/DATA/production/common/readAO2Ds.C > checkAO2D.log
174+
exitcode=$?
175+
if [[ $exitcode -ne 0 ]]; then
176+
echo "exit code from AO2D check is " $exitcode > validation_error.message
177+
echo "exit code from AO2D check is " $exitcode
178+
exit $exitcode
179+
fi
180+
${O2DPG_ROOT}/MC/analysis_testing/o2dpg_analysis_test_workflow.py --merged-task -f AO2D.root
181+
${O2DPG_ROOT}/MC/bin/o2_dpg_workflow_runner.py -f workflow_analysis_test.json > analysisQC.log
182+
if [[ -f "Analysis/MergedAnalyses/AnalysisResults.root" ]]; then
183+
mv Analysis/MergedAnalyses/AnalysisResults.root .
184+
else
185+
echo "No Analysis/MergedAnalyses/AnalysisResults.root found! check analysis QC"
186+
fi
187+
if ls Analysis/*/*.log 1> /dev/null 2>&1; then
188+
mv Analysis/*/*.log .
189+
fi
190+
fi
191+
192+
# copying the QC json file here
193+
if [[ ! -z $QC_JSON_FROM_OUTSIDE ]]; then
194+
QC_JSON=$QC_JSON_FROM_OUTSIDE
195+
else
196+
if [[ -d $GEN_TOPO_WORKDIR/json_cache ]]; then
197+
echo "copying latest file found in ${GEN_TOPO_WORKDIR}/json_cache"
198+
QC_JSON=`ls -dArt $GEN_TOPO_WORKDIR/json_cache/* | tail -n 1`
199+
else
200+
echo "No QC files found, probably QC was not run"
201+
fi
202+
fi
203+
if [[ ! -z $QC_JSON ]]; then
204+
cp $QC_JSON QC_production.json
205+
fi

0 commit comments

Comments
 (0)