Skip to content

Commit 25fa7c8

Browse files
committed
Add script to be used as cronjob to automatically submit DQM jobs on DIRAC once a run has been transferred from CEA to DIRAC
1 parent 47c56c5 commit 25fa7c8

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env bash
2+
# -*- coding: utf-8 -*-
3+
#
4+
# Author: Jean-Philippe Lenain <[email protected]>
5+
#
6+
# Script as a cronjob to dynamically launch NectarCAM DQM runs on DIRAC after data transfer, to be run once a day on sedipccaa23 in CEA/Irfu.
7+
8+
# Log everything to $LOGFILE
9+
LOGFILE=${0%".sh"}_$(date +%F).log
10+
exec 1>"$LOGFILE" 2>&1
11+
12+
localParentDir="/data/nvme/ZFITS"
13+
remoteParentDir="/vo.cta.in2p3.fr/nectarcam"
14+
nectarchainScriptDir="$HOME/local/src/python/cta-observatory/nectarchain/src/nectarchain/user_scripts/jlenain/dqm_job_submitter"
15+
16+
cd $nectarchainScriptDir
17+
18+
for run in $(find ${localParentDir} -type f -name "NectarCAM*.fits.fz" | awk -F. '{print $2}' | awk -Fn '{print $2}' | sort | uniq); do
19+
echo "Probing files for run ${run}"
20+
nbLocalFiles=$(find ${localParentDir} -type f -name "NectarCAM.Run${run}.????.fits.fz" | wc -l)
21+
echo " Found $nbLocalFiles local files for run $run"
22+
nbRemoteFiles=$(dfind $remoteParentDir | grep -e "NectarCAM.Run${run}" | grep -e "fits.fz" | wc -l)
23+
echo " Found $nbRemoteFiles remote files on DIRAC for run $run"
24+
# If number of local and remote files matching, will attempt to launch a DQM run
25+
if [ $nbLocalFiles -eq $nbRemoteFiles ]; then
26+
echo " Run $run: number of local and remote files matching, will attempt to submit a DQM job"
27+
yyyymmdd=$(find ${localParentDir} -type f -name "NectarCAM.Run${run}.????.fits.fz" | head -n 1 | awk -F/ '{print $6}')
28+
yyyy=${yyyymmdd:0:4}
29+
mm=${yyyymmdd:4:2}
30+
dd=${yyyymmdd:6:2}
31+
cmd="python submit_dqm_processor.py -d "${yyyy}-${mm}-${dd}" -r $run"
32+
echo "Running: $cmd"
33+
eval $cmd
34+
else
35+
echo " Run $run is not yet complete on DIRAC, will wait another day before launching a DQM job on it."
36+
fi
37+
done

0 commit comments

Comments
 (0)