Skip to content

Commit a3bea98

Browse files
committed
GRID embedding bench: Collect output + cleanup
Introducing better organization: Persistent results are collected in an output folder. (So that's its easier for a GRID job to know what to keep).
1 parent b67c0cf commit a3bea98

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

MC/run/PWGHF/embedding_benchmark.sh

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,21 @@ NWORKERS=${NWORKERS:-8}
1717
NBKGEVENTS=${NBKGEVENTS:-20}
1818
MODULES="--skipModules ZDC"
1919

20+
# We will collect output files of the workflow in a dedicated output dir
21+
# (these are typically the files that should be left-over from a GRID job)
22+
[ ! -d output ] && mkdir output
23+
24+
copypersistentsimfiles() {
25+
simprefix=$1
26+
outputdir=$2
27+
cp ${simprefix}_Kine.root ${simprefix}_grp.root ${simprefix}*.ini ${outputdir}
28+
}
2029

2130
# background task -------
2231
taskwrapper bkgsim.log o2-sim -j ${NWORKERS} -n ${NBKGEVENTS} -g pythia8hi ${MODULES} -o bkg \
2332
--configFile ${O2DPG_ROOT}/MC/config/common/ini/basic.ini
33+
# register some background output --> make this declarative
34+
copypersistentsimfiles bkg output
2435

2536
# loop over timeframes
2637
for tf in `seq 1 ${NTIMEFRAMES}`; do
@@ -47,10 +58,13 @@ for tf in `seq 1 ${NTIMEFRAMES}`; do
4758
--embedIntoFile bkg_Kine.root \
4859
-o sgn${tf}
4960

50-
CONTEXTFILE=collisioncontext_${tf}.root
51-
61+
# register some signal output --> make this declarative
62+
copypersistentsimfiles sgn${tf} output
63+
# we need to copy the current grp for tpc-reco
5264
cp sgn${tf}_grp.root o2sim_grp.root
5365

66+
CONTEXTFILE=collisioncontext_${tf}.root
67+
5468
# now run digitization phase
5569
echo "Running digitization for $intRate kHz interaction rate"
5670

@@ -75,6 +89,12 @@ for tf in `seq 1 ${NTIMEFRAMES}`; do
7589
# we need to move these products somewhere
7690
mv tpctracks.root tpctracks_${tf}.root
7791

92+
# we essentially only keep tpctracks
93+
mv tpctracks_${tf}.root output
94+
cp ${CONTEXTFILE} output
95+
96+
# cleanup step for this timeframe (we cleanup disc space early so as to make possible checkpoint dumps smaller)
97+
taskwrapper cleanup_${tf}.log "[ -f tpcreco_${tf}.log_done ] && rm sgn${tf}* && rm *digits*.root"
7898
done
7999

80100
# We need to exit for the ALIEN JOB HANDLER!

0 commit comments

Comments
 (0)