Skip to content

Commit 15d2c67

Browse files
committed
Setup to test anchorMC in the 2tag approach
Provides * Template file to generate anchored MC jobs * A driver script creating actual test jobs and executing them on the GRID * CSV data file specifying which software tags should be tested The idea is that this should be used to check if MC (daily) releases are compatible with the 2tag approach relative to a given set of async software releases.
1 parent 02dfd45 commit 15d2c67

File tree

3 files changed

+221
-0
lines changed

3 files changed

+221
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/bash
2+
#JDL_OUTPUT=*.txt@disk=1,AO2D.root@disk=2,*.log@disk=1,*stat*@disk=1,*.json@disk=1,debug*tgz@disk=2
3+
#JDL_ERROROUTPUT=*.txt@disk=1,AO2D.root@disk=2,*.log@disk=1,*.json@disk=1,debug*tgz@disk=2
4+
#JDL_PACKAGE=%{SOFTWARETAG_SIM}
5+
#JDL_REQUIRE=%{JDL_REQUIREMENT}
6+
7+
#
8+
# A template anchoring script to test various anchoring setups
9+
# and software combinations
10+
#
11+
12+
# only relevant if executed locally
13+
if [ ! ${O2_ROOT} ]; then
14+
source <(/cvmfs/alice.cern.ch/bin/alienv printenv %{SOFTWARETAG_SIM})
15+
fi
16+
17+
# meta configuration of the job (influences reco config)
18+
export ALIEN_JDL_LPMPRODUCTIONTYPE=MC
19+
export ALIEN_JDL_CPULIMIT=8
20+
21+
export ALIEN_JDL_LPMANCHORPASSNAME=%{PASSNAME}
22+
export ALIEN_JDL_MCANCHOR=%{PASSNAME}
23+
export ALIEN_JDL_COLLISIONSYSTEM=%{COL_SYSTEM}
24+
export ALIEN_JDL_LPMPASSNAME=%{PASSNAME}
25+
export ALIEN_JDL_LPMRUNNUMBER=%{RUN_NUMBER}
26+
export ALIEN_JDL_LPMANCHORRUN=%{RUN_NUMBER}
27+
28+
export ALIEN_JDL_LPMINTERACTIONTYPE=%{INTERACTIONTYPE}
29+
export ALIEN_JDL_LPMPRODUCTIONTAG=%{PRODUCTION_TAG}
30+
export ALIEN_JDL_LPMANCHORPRODUCTION=%{ANCHOR_PRODUCTION}
31+
export ALIEN_JDL_LPMANCHORYEAR=%{ANCHORYEAR}
32+
export ALIEN_JDL_O2DPG_ASYNC_RECO_TAG="%{SOFTWARETAG_ASYNC}"
33+
34+
# get custom O2DPG for 2tag treatment (could be used to test different O2DPG branches)
35+
# git clone https://github.com/AliceO2Group/O2DPG O2DPG
36+
# export O2DPG_ROOT=${PWD}/O2DPG
37+
# export ALIEN_JDL_O2DPG_OVERWRITE=${PWD}/O2DPG
38+
39+
# dimension the job
40+
export NTIMEFRAMES=1
41+
42+
# further configuration of the job
43+
export ALIEN_JDL_ADDTIMESERIESINMC=0
44+
export DISABLE_QC=1
45+
export ALIEN_JDL_MC_ORBITS_PER_TF=10000:10000000:2 # puts just 2 orbit for large enough interaction rates
46+
export ALIEN_JDL_O2DPGWORKFLOWTARGET="aod"
47+
48+
# select anchoring points
49+
export PRODSPLIT=${ALIEN_O2DPG_GRIDSUBMIT_PRODSPLIT:-100}
50+
export SPLITID=${ALIEN_O2DPG_GRIDSUBMIT_SUBJOBID:-50}
51+
export CYCLE=0
52+
53+
# generator and other sim configuration
54+
export ALIEN_JDL_ANCHOR_SIM_OPTIONS="%{SIM_OPTIONS}"
55+
56+
# execute MC
57+
# ${O2DPG_ROOT}/MC/run/ANCHOR/anchorMC.sh
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# comment (no empty lines allowed)
2+
%{SOFTWARETAG_SIM},%{SOFTWARETAG_ASYNC},%{PASSNAME},%{COL_SYSTEM},%{RUN_NUMBER},%{INTERACTIONTYPE},%{ANCHOR_PRODUCTION},%{ANCHORYEAR},%{SIM_OPTIONS},%{PRODUCTION_TAG}
3+
#O2sim::v20250306-1,O2PDPSuite::async-async-v1-01-08-slc9-alidist-async-v1-01-01-1,apass7,p-p,526641,pp,LHC25a9_Plus10,LHC22o,2022,-gen pythia8
4+
#O2sim::v20250305-1,O2PDPSuite::async-async-v1-01-12-slc9-alidist-async-v1-01-01-1,apass1,p-p,551398,pp,LHC25a7_Plus10,LHC24ag,2024,-gen pythia8
5+
#O2sim::v20250305-1,O2PDPSuite::async-async-v1-02-10-slc9-alidist-async-v1-02-01-1,apass1,Pb-Pb,559544,PbPb,LHC25c5b,LHC24ar,2024,-gen pythia8 -confKey 'SimCutParams.globalDensityFactor=0.9f'
6+
#O2sim::v20250806-1,O2PDPSuite::async-async-2024-PbPb-apass1-v2-slc9-alidist-async-2024-PbPb-apass1-v2-1,apass1,Pb-Pb,559544,PbPb,LHC25c5b,LHC24ar,2024,-gen pythia8
7+
# 2022
8+
# O2PDPSuite::async-async-2022-pp-apass7-v1,apass7, | 526641
9+
# 2023
10+
O2sim::v20250806-1,O2PDPSuite::async-async-2023-PbPb-apass5-v5-slc9-alidist-async-2023-PbPb-apass5-v5-1,apass5,Pb-Pb,544091,PbPb,LHC23zzh,2023,-gen pythia8
11+
# 2024
12+
O2sim::v20250806-1,O2PDPSuite::async-async-2024-pp-apass1-v7-slc9-alidist-async-2024-pp-apass1-v7-1,apass1,p-p,553185,pp,LHC24al,2024,-gen pythia8
13+
O2sim::v20250806-1,O2PDPSuite::async-async-2024-ppRef-apass1-v1-slc9-alidist-async-2024-ppRef-apass1-v1-1,apass1,p-p,559348,pp,LHC24ap,2024,-gen pythia8
14+
O2sim::v20250806-1,O2PDPSuite::async-async-2024-pbpb-apass2-v3-slc9-alidist-async-2024-pbpb-apass2-v3-1,apass2,Pb-Pb,559545,PbPb,LHC24ar,2024,-gen pythia8
15+
# 2025
16+
O2sim::v20250806-1,O2PDPSuite::async-async-2025-pO-apass1-v2-slc9-alidist-async-2025-pO-apass1-v2-1,apass1,p-O,564251,pO,LHC25ad,2025,-gen pythia8
17+
O2sim::v20250806-1,O2PDPSuite::async-async-2025-OO-apass1-v2-slc9-alidist-async-2025-OO-apass1-v2-1,apass1,O-O,564356,OO,LHC25ae,2025,-gen pythia8
18+
O2sim::v20250806-1,O2PDPSuite::async-async-2025-NeNe-apass1-v2-slc9-alidist-async-2025-NeNe-apass1-v2-1,apass1,Ne-Ne,564468,NeNe,LHC25af,2025,-gen pythia8
19+
# apass2
20+
O2sim::v20250806-1,O2PDPSuite::async-async-2025-pO-apass2-v1-slc9-alidist-async-2025-pO-apass2-v1-1,apass2,p-O,564251,pO,LHC25ad,2025,-gen pythia8
21+
O2sim::v20250806-1,O2PDPSuite::async-async-2025-OO-apass2-v1-slc9-alidist-async-2025-OO-apass2-v1-1,apass2,O-O,564356,OO,LHC25ae,2025,-gen pythia8
22+
O2sim::v20250806-1,O2PDPSuite::async-async-2025-NeNe-apass2-v1-slc9-alidist-async-2025-NeNe-apass2-v1-1,apass2,Ne-Ne,564468,NeNe,LHC25af,2025,-gen pythia8

MC/run/ANCHOR/tests/test_looper.sh

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
#!/bin/bash
2+
# loops over all test cases and executes them
3+
4+
# Read the CSV file
5+
INPUT_FILE="test_anchor_cases.csv"
6+
TEMPLATE_FILE="test_anchor_2tag_template.sh"
7+
OUTPUT_FILE="test_anchor_generated"
8+
9+
DAILYTAGTOTEST=${1:-O2sim::v20250804-1}
10+
11+
SITES_FILE="test_GRID_sites.dat"
12+
13+
WORKING_DIR="${PWD}/workdir_$(date +%s)_$RANDOM"
14+
echo "WORKING DIR ${WORKING_DIR}"
15+
mkdir -p ${WORKING_DIR}
16+
17+
INPUT_FILE_STRIPPED=${WORKING_DIR}/${INPUT_FILE}_clean
18+
19+
REQUIRE_STRING=""
20+
{
21+
while read -r -a values; do
22+
if [ ! "${REQUIRE_STRING}" == "" ]; then
23+
REQUIRE_STRING="${REQUIRE_STRING} ||"
24+
fi
25+
REQUIRE_STRING="${REQUIRE_STRING} (other.CE == \"${values}\")"
26+
done
27+
} < ${SITES_FILE}
28+
REQUIRE_STRING="(${REQUIRE_STRING});"
29+
30+
echo "REQUIRE STRING ${REQUIRE_STRING}"
31+
32+
# strip comments from CSV file
33+
grep -v '#' ${INPUT_FILE} > ${INPUT_FILE_STRIPPED}
34+
35+
# Read the header line and convert it into variable names
36+
IFS=',' read -r -a headers < "$INPUT_FILE_STRIPPED"
37+
38+
# Replace placeholders in the header (e.g., %{VAR} → VAR)
39+
for i in "${!headers[@]}"; do
40+
headers[$i]=$(echo "${headers[$i]}" | sed -E 's/#?%\{//;s/\}//g')
41+
done
42+
43+
# Read and process each subsequent line
44+
{
45+
read # Skip the header line
46+
47+
count=1 # Counter for output files
48+
datestring=$(date +"%Y%m%d_%H%M%S")
49+
while IFS=',' read -r -a values; do
50+
# Assign each value to its corresponding variable
51+
for i in "${!headers[@]}"; do
52+
declare "${headers[$i]}"="${values[$i]}"
53+
done
54+
55+
PRODUCTION_TAG="2tagtest_${datestring}_${count}"
56+
# Example: Print assigned variables
57+
echo "SOFTWARETAG_SIM: $SOFTWARETAG_SIM"
58+
echo "SOFTWARETAG_ASYNC: $SOFTWARETAG_ASYNC"
59+
echo "PASSNAME: $PASSNAME"
60+
echo "COL_SYSTEM: $COL_SYSTEM"
61+
echo "RUN_NUMBER: $RUN_NUMBER"
62+
echo "INTERACTIONTYPE: $INTERACTIONTYPE"
63+
echo "PRODUCTION_TAG: $PRODUCTION_TAG"
64+
echo "ANCHOR_PRODUCTION: $ANCHOR_PRODUCTION"
65+
echo "ANCHORYEAR: $ANCHORYEAR"
66+
echo "SIM_OPTIONS: $SIM_OPTIONS"
67+
echo "--------------------------------"
68+
69+
if [ "${DAILYTAGTOTEST}" ]; then
70+
SOFTWARETAG_SIM=${DAILYTAGTOTEST}
71+
fi
72+
73+
OUTPUT_FILE_FINAL="${WORKING_DIR}/${OUTPUT_FILE}_case${count}.sh"
74+
75+
# create final test script with these values
76+
cp "$TEMPLATE_FILE" "${OUTPUT_FILE_FINAL}"
77+
for var in "${headers[@]}"; do
78+
sed -i "s|%{$var}|${!var}|g" "$OUTPUT_FILE_FINAL"
79+
done
80+
# put the require spec
81+
sed -i "s/%{JDL_REQUIREMENT}/${REQUIRE_STRING}/g" "$OUTPUT_FILE_FINAL"
82+
83+
# we submit the test to the GRID (multiplicity of 4)
84+
# ${WORKING_DIR}/submit_case${count}_${SOFTWARETAG_ASYNC//::/-}
85+
echo "${O2DPG_ROOT}/GRID/utils/grid_submit.sh --prodsplit 4 --singularity --ttl 3600 --script ${OUTPUT_FILE_FINAL} --jobname "anchorTest_${count}" --wait-any --topworkdir 2tag_release_testing_${SOFTWARETAG_SIM}" > ${WORKING_DIR}/submit_case${count}.sh
86+
# TODO: optional local execution with --local option
87+
88+
((count++)) # Increment counter for next row
89+
done
90+
} < "${INPUT_FILE_STRIPPED}" #Redirect file input here to avoid subshell issues
91+
92+
cd ${WORKING_DIR}
93+
94+
# now we submit all the jobs in the background and wait for them to return
95+
for s in `ls submit*.sh`; do
96+
echo "submitting ${s}"
97+
export GRID_SUBMIT_WORKDIR="${WORKING_DIR}/${s}_workdir"
98+
(
99+
bash ${s} &> log_${s}
100+
echo "Job ${s} returned"
101+
) &
102+
done
103+
104+
# for for all (GRID) jobs to return
105+
echo "Waiting for jobs to return/finish"
106+
wait
107+
108+
# verify / validate the output produced from these jobs
109+
# The test is successfull if at least one subjob from each test
110+
# produced the AO2D output.
111+
echo "-- Jobs done ... validating --"
112+
113+
FINAL_SUCCESS=0
114+
for s in `ls submit*.sh`; do
115+
# find output path
116+
TEST_OUTPUT_PATH="${WORKING_DIR}/${s}_workdir" # $(grep "Local working directory is" log_${s} | awk '//{print $5}')
117+
118+
# get the Output path on JAlien from the JDL
119+
ALIEN_OUTPUT_FOLDER=$(grep 'OutputDir' ${TEST_OUTPUT_PATH}/*.jdl | cut -d'"' -f2 | sed 's|/[^/]*#.*#.*$||')
120+
121+
# see if there is an AO2D.root and a workflow.json in one of the jobs in that folder
122+
AODS_FOUND=$(alien.py find ${ALIEN_OUTPUT_FOLDER} AO2D.root)
123+
WORKFLOWS_FOUND=$(alien.py find ${ALIEN_OUTPUT_FOLDER} workflow.json)
124+
125+
if [[ -z ${WORKFLOWS_FOUND} || -z ${AODS_FOUND} ]]; then
126+
echo "❌ Missing files for case $s"
127+
FINAL_SUCCESS=1 # mark as failure
128+
else
129+
echo "✅ Files found in $s"
130+
fi
131+
done
132+
133+
if [[ ${FINAL_SUCCESS} -eq 0 ]]; then
134+
echo "✅ All submissions have required files."
135+
else
136+
echo "❌ Some submissions are missing required files."
137+
fi
138+
139+
#TODO: echo "-- Cleaning up ... "
140+
cd ..
141+
142+
exit ${FINAL_SUCCESS}

0 commit comments

Comments
 (0)