1 |
#!/bin/bash
|
2 |
|
3 |
######################################################
|
4 |
# heds 0 (create new directories)
|
5 |
# heds 1 (query runregistry)
|
6 |
# heds 2 (create crab task)
|
7 |
# heds 3 (get and publish jobs)
|
8 |
# heds 4 (create all the html tables and store logs)
|
9 |
# heds 5* (event display stuff)
|
10 |
######################################################
|
11 |
|
12 |
choice=$1
|
13 |
|
14 |
dailySkim=$HEDS_NAMEPREFIX$HEDS_LABEL-v$HEDS_TASKATTEMPT
|
15 |
|
16 |
|
17 |
|
18 |
case $choice in
|
19 |
######### "public functions" which are meant to be called by the users ################
|
20 |
up) ### bootstrap for heds job submission. It creates the intial configuration file
|
21 |
whoami=`whoami`
|
22 |
cat > ./heds.cfg <<EOF
|
23 |
### insert a day of data-taking in the format DD.MM.YYYY
|
24 |
HEDS_LABEL=18.04.2010
|
25 |
|
26 |
### name of the local folder containing the configuration and output of your heds task
|
27 |
HEDS_LOCALSTORE=""
|
28 |
|
29 |
### input sample
|
30 |
#HEDS_INPUTDATASET=/MinimumBias/Commissioning10-Apr20ReReco-v1/RECO #up to run 133532
|
31 |
HEDS_INPUTDATASET=/MinimumBias/Commissioning10-PromptReco-v9/RECO #starting from run 133532
|
32 |
|
33 |
|
34 |
HEDS_SKIMVERSION=99
|
35 |
HEDS_TASKATTEMPT=1
|
36 |
|
37 |
HEDS_USERID=$whoami
|
38 |
HEDS_T2SITE=T2_US_UCSD
|
39 |
|
40 |
|
41 |
### TO BE FIXED. THESE VARIABLE COULD BE RETRIEVED FROM A QUERY TO PHEDEX ###
|
42 |
HEDS_STORAGEPATH=/srm/v2/server?SFN=/hadoop/cms
|
43 |
HEDS_STORAGEPORT=8443
|
44 |
EOF
|
45 |
echo -e "+++ Bootstrap of \"heds\" scripts peformed"
|
46 |
echo -e "+++ The configuration file \"heds.cfg\" has been created in the current folder:"
|
47 |
echo -e " "$PWD "\n"
|
48 |
echo "+++ Edit the heds.cfg according to your needs and then execute: "
|
49 |
echo -e " ""heds.sh create heds.cfg"
|
50 |
;;
|
51 |
|
52 |
create) ### create local heds taskFolder
|
53 |
configFile=$2
|
54 |
if [ -z "$configFile" ]; then
|
55 |
echo "+++ ERROR: you have to specify the configuration file as in:"
|
56 |
echo " heds.sh create <heds.cfg>"
|
57 |
exit 1
|
58 |
fi
|
59 |
|
60 |
if [ -z "$CMSSW_BASE" ]; then
|
61 |
echo "+++ ERROR: you have to setup CMSSW environment first. Run cmsenv";
|
62 |
(exit 1;)
|
63 |
fi
|
64 |
|
65 |
if [ ! -d $CMSSW_BASE/src/HiggsAnalysis/EarlyDataStudy/scripts ]; then
|
66 |
echo "+++ ERROR: you have to checkout and compile \"HiggsAnalysis/EarlyDataStudy\" first.";
|
67 |
(exit 1;)
|
68 |
fi
|
69 |
|
70 |
|
71 |
|
72 |
# get rid of lines with comments
|
73 |
grep -v '^#' $configFile > tmpFile
|
74 |
mv tmpFile ${configFile}
|
75 |
|
76 |
# add export lines
|
77 |
grep -v '^$' ${configFile}| awk '{print "export "$0}' > tmpFile
|
78 |
mv tmpFile ${configFile}
|
79 |
|
80 |
# define default taskFolder if it is not defined in the cfg file
|
81 |
source ${configFile}
|
82 |
autoString=heds_skim${HEDS_LABEL}_created_`date '+%d.%m.%Y_%H.%M'`
|
83 |
if [ -z "$HEDS_LOCALSTORE" ]; then
|
84 |
sed "s#HEDS_LOCALSTORE=\"\"#HEDS_LOCALSTORE=$autoString#" ${configFile} > tmpFile
|
85 |
mv tmpFile ${configFile}
|
86 |
fi
|
87 |
|
88 |
# make taskFolder path absolute
|
89 |
tmpString="HEDS_LOCALSTORE=`pwd`/"
|
90 |
sed "s#HEDS_LOCALSTORE=#$tmpString#" ${configFile} > tmpFile
|
91 |
mv tmpFile ${configFile}
|
92 |
|
93 |
source ${configFile}
|
94 |
|
95 |
cat >> ${configFile} <<EOF
|
96 |
###### this part was not set by the user. It was automatically generated ########
|
97 |
export HEDS_NAMEPREFIX=HiggsSimpleSkimV${HEDS_SKIMVERSION}\_
|
98 |
export HEDS_CASTORFOLDER=/castor/cern.ch/user/${HEDS_USERID:0:1}/$HEDS_USERID/HEDS
|
99 |
export HEDS_WWWAREA_TMP=${HEDS_LOCALSTORE}/wwwPagesInPreliminaryShape
|
100 |
export HEDS_WWWAREA=/afs/cern.ch/cms/Physics/Higgs/HiggsDQM/HiggsEDS
|
101 |
export HEDSPATH=$CMSSW_BASE/src/HiggsAnalysis/EarlyDataStudy
|
102 |
EOF
|
103 |
|
104 |
|
105 |
|
106 |
if [ -d $HEDS_LOCALSTORE ]; then
|
107 |
echo "ERROR: the folder" $HEDS_LOCALSTORE "already exists." \
|
108 |
"Plese specify a different one in your .cfg file"
|
109 |
exit 1
|
110 |
else
|
111 |
mkdir $HEDS_LOCALSTORE
|
112 |
mv ./${configFile} $HEDS_LOCALSTORE/configuration
|
113 |
fi
|
114 |
|
115 |
cat > $HEDS_LOCALSTORE/status <<EOF
|
116 |
create
|
117 |
EOF
|
118 |
|
119 |
|
120 |
;;
|
121 |
|
122 |
submit) ### start doing something serious using the settings stored in the hedsTaskFolder
|
123 |
hedsTaskFolder=$2
|
124 |
if [ -z "$hedsTaskFolder" -o ! -d ./$hedsTaskFolder ]; then
|
125 |
echo -e "+++ ERROR: you have to specify a \"hedsTaskFolder\" as in: "
|
126 |
echo " heds.sh submit <hedsTaskFolder>"
|
127 |
exit 1
|
128 |
fi
|
129 |
|
130 |
echo -e "+++ Your heds task is going to use the following settings: \n"
|
131 |
cat ./$hedsTaskFolder/configuration |sed "s#export ##" |grep -v '^#'
|
132 |
|
133 |
source ./$hedsTaskFolder/configuration
|
134 |
|
135 |
echo -e "\n"
|
136 |
|
137 |
echo -e "+++ Are you Ok with such settings? [y/n] "
|
138 |
|
139 |
|
140 |
read -p "$prompt" answer
|
141 |
case "$answer" in
|
142 |
[yY1] )
|
143 |
echo -e "\n"
|
144 |
;;
|
145 |
[nN0] )
|
146 |
echo -e "+++ You can change the settings editing the configuration file saved"
|
147 |
echo -e " in your newly created heds task folder:"
|
148 |
echo -e " ./$hedsTaskFolder/configuration"
|
149 |
|
150 |
exit
|
151 |
;;
|
152 |
*)
|
153 |
echo -e "Incorrect answer. Run \"heds submit\" again and type [y/n]"
|
154 |
exit
|
155 |
;;
|
156 |
esac
|
157 |
|
158 |
echo -e "+++ Have you also checked HEDS_STORAGEPATH and HEDS_STORAGEPORT values ? "
|
159 |
echo -e "+++ This values have still to be set by hand. Please consult the settings of your T2's SE"
|
160 |
echo -e " as described here:"
|
161 |
echo " https://twiki.cern.ch/twiki/bin/view/CMS/AnalysisOpsPriorityuser#Tier_2_Sites_Responsibility"
|
162 |
echo "Please insert the final confirmation [y/n]"
|
163 |
read -p "$prompt" answer
|
164 |
case "$answer" in
|
165 |
[yY1] )
|
166 |
echo -e "\n"
|
167 |
;;
|
168 |
[nN0] )
|
169 |
echo -e "+++ You can change the settings editing the configuration file saved"
|
170 |
echo -e " in your newly created heds task folder:"
|
171 |
echo -e " ./$hedsTaskFolder/configuration"
|
172 |
exit
|
173 |
;;
|
174 |
*)
|
175 |
echo -e "Incorrect answer. Run \"heds submit\" again and type [y/n]"
|
176 |
exit
|
177 |
;;
|
178 |
esac
|
179 |
|
180 |
if grid-proxy-info 2>&1 |grep ERROR;then
|
181 |
echo "You may have to generate a grid proxy first. Use:"
|
182 |
echo " voms-proxy-init -voms cms"
|
183 |
exit 1
|
184 |
fi
|
185 |
|
186 |
|
187 |
initialFolder=`pwd`
|
188 |
cd $HEDS_LOCALSTORE
|
189 |
heds.sh 0 #create setup
|
190 |
heds.sh 1 #query runregistry, create crab cfg
|
191 |
heds.sh 2 #submit crab jobs
|
192 |
|
193 |
cd $initialFolder
|
194 |
;;
|
195 |
|
196 |
|
197 |
status) ### check status
|
198 |
hedsTaskFolder=$2
|
199 |
if [ -z "$hedsTaskFolder" -o ! -d ./$hedsTaskFolder ]; then
|
200 |
echo -e "+++ ERROR: you have to specify a \"hedsTaskFolder\" as in: "
|
201 |
echo " heds.sh status <hedsTaskFolder>"
|
202 |
exit 1
|
203 |
fi
|
204 |
source ./$hedsTaskFolder/configuration
|
205 |
|
206 |
initialFolder=`pwd`
|
207 |
cd $HEDS_LOCALSTORE
|
208 |
status=`tail -n1 status`
|
209 |
|
210 |
case $status in
|
211 |
create)
|
212 |
echo "+++ Last step successfully execute was: "
|
213 |
echo -e " heds create <taskFolder>\n"
|
214 |
echo "+++ Next step to run is: "
|
215 |
echo -e " heds submit <taskFolder>"
|
216 |
;;
|
217 |
submit)
|
218 |
echo "+++ Last step execute was: "
|
219 |
echo -e " heds submit <taskFolder>\n"
|
220 |
|
221 |
dailySkim=$HEDS_NAMEPREFIX$HEDS_LABEL-v$HEDS_TASKATTEMPT
|
222 |
crab -status -c $HEDS_LOCALSTORE/$dailySkim >& crab.status.log
|
223 |
jobsOK=`grep "Wrapper Exit Code : 0" crab.status.log| awk '{print $2}'`
|
224 |
jobsDone=`grep ">>>>>>>>>" crab.status.log |grep "Jobs Done"| awk '{print $2}'`
|
225 |
jobsRunning=`grep ">>>>>>>>>" crab.status.log |grep "Jobs Running"| awk '{print $2}'`
|
226 |
jobsAborted=`grep ">>>>>>>>>" crab.status.log |grep "Jobs Aborted"| awk '{print $2}'`
|
227 |
jobsTotal=`grep "crab:" crab.status.log |grep "Total Jobs"| awk '{print $2}'`
|
228 |
|
229 |
if [ -n "$jobsTotal" ]; then echo "# jobs Total: " $jobsTotal; else jobsTotal=0; fi
|
230 |
if [ -n "$jobsDone" ]; then echo "# jobs Done: " $jobsDone; else jobsDone=0; fi
|
231 |
if [ -n "$jobsRunning" ]; then echo "# jobs Running: " $jobsRunning; else jobsRunning=0; fi
|
232 |
if [ -n "$jobsAborted" ]; then echo "# jobs Aborted: " $jobsAborted; else jobsAborted=0; fi
|
233 |
if [ -n "$jobsOK" ]; then echo "# jobs Retrieved OK: " $jobsOK; else jobsOK=0; fi
|
234 |
|
235 |
if(($jobsDone)); then
|
236 |
echo "There are jobs in DONE status. Retrieving them"
|
237 |
crab -get -c $HEDS_LOCALSTORE/$dailySkim > /dev/null
|
238 |
|
239 |
echo "+++ Run the following command again: "
|
240 |
echo " heds status <taskFolder>"
|
241 |
exit 0
|
242 |
fi
|
243 |
|
244 |
if [ "$jobsTotal" == "$jobsOK" ];
|
245 |
then
|
246 |
echo "+++ all the crab jobs has been correctly retrieved."
|
247 |
echo "+++ You can now run:"
|
248 |
echo " heds get <taskFolder>"
|
249 |
cat >> $HEDS_LOCALSTORE/status <<EOF
|
250 |
crab_done
|
251 |
EOF
|
252 |
else
|
253 |
if(($jobsAborted)); then
|
254 |
echo "+++ Some crab jobs aborted. You need to resubmit them directly using:"
|
255 |
echo " crab -resubmit <job-interval> -c $HEDS_LOCALSTORE/$dailySkim"
|
256 |
|
257 |
else
|
258 |
echo "+++ There are still crab jobs running. Try again later."
|
259 |
echo "+++ You can directly handle your crab jobs with:"
|
260 |
echo " crab -<command> -c $HEDS_LOCALSTORE/$dailySkim"
|
261 |
fi
|
262 |
fi
|
263 |
;;
|
264 |
|
265 |
submit_empty)
|
266 |
echo "+++ Last step execute was: "
|
267 |
echo -e " heds submit <taskFolder>\n"
|
268 |
|
269 |
echo "+++ No good runs were found, so no crab jobs were submitted."
|
270 |
echo " You can directly go to the step:"
|
271 |
echo " heds tables <taskFolder>"
|
272 |
;;
|
273 |
|
274 |
crab_done)
|
275 |
echo "+++ All you crab jobs are DONE."
|
276 |
echo " You can now run:"
|
277 |
echo " heds get <taskFolder>"
|
278 |
;;
|
279 |
|
280 |
get)
|
281 |
echo "+++ Last step successfully execute was: "
|
282 |
echo -e " heds get <taskFolder>\n"
|
283 |
echo "+++ Next step to run is: "
|
284 |
echo -e " heds merge <taskFolder>"
|
285 |
;;
|
286 |
|
287 |
merge)
|
288 |
echo "+++ Last step successfully execute was: "
|
289 |
echo -e " heds merge <taskFolder>\n"
|
290 |
echo "+++ Next step to run is: "
|
291 |
echo -e " heds tables <taskFolder>"
|
292 |
;;
|
293 |
|
294 |
tables)
|
295 |
echo "+++ Last step successfully execute was: "
|
296 |
echo -e " heds tables <taskFolder>\n"
|
297 |
echo "+++ Next step to run is: "
|
298 |
echo -e " heds preview <taskFolder>"
|
299 |
;;
|
300 |
|
301 |
preview)
|
302 |
echo "+++ Last step successfully execute was: "
|
303 |
echo -e " heds preview <taskFolder>\n"
|
304 |
echo "+++ Next step to run is: "
|
305 |
echo -e " heds add2Web <taskFolder>"
|
306 |
;;
|
307 |
|
308 |
add2Web)
|
309 |
echo "+++ Last step successfully execute was: "
|
310 |
echo -e " heds add2Web <taskFolder>\n"
|
311 |
echo "+++ You are done "
|
312 |
;;
|
313 |
|
314 |
*)
|
315 |
echo "+++ ERROR: undefined heds status."
|
316 |
echo "+++ Restart from scratch running:"
|
317 |
echo " heds up"
|
318 |
echo " heds create heds.cfg"
|
319 |
;;
|
320 |
esac
|
321 |
cd $initialFolder
|
322 |
;;
|
323 |
|
324 |
|
325 |
get) ### get output from crab
|
326 |
hedsTaskFolder=$2
|
327 |
if [ -z "$hedsTaskFolder" -o ! -d ./$hedsTaskFolder ]; then
|
328 |
echo -e "+++ ERROR: you have to specify a \"hedsTaskFolder\" as in: "
|
329 |
echo " heds.sh status <hedsTaskFolder>"
|
330 |
exit 1
|
331 |
fi
|
332 |
|
333 |
source ./$hedsTaskFolder/configuration
|
334 |
cd $HEDS_LOCALSTORE
|
335 |
status=`tail -n1 status`
|
336 |
if [ ! "$status" == "crab_done" ];then
|
337 |
echo "+++ ERROR: crab jobs are not done yet. Try:"
|
338 |
echo " heds status <taskFolder>"
|
339 |
exit 1
|
340 |
fi
|
341 |
|
342 |
echo "Crab job's output is going to be published in DBS. This step is going to take a long while (up to 1hr)."
|
343 |
echo "Do you have time for that? [y/n]"
|
344 |
|
345 |
read -p "$prompt" answer
|
346 |
case "$answer" in
|
347 |
[yY1] )
|
348 |
echo "Ok. Proceding with crab -publish step"
|
349 |
;;
|
350 |
[nN0] )
|
351 |
echo "Exiting heds.."
|
352 |
exit 0
|
353 |
;;
|
354 |
*)
|
355 |
echo -e "Incorrect answer. Run your heds get command again and then answer [y/n]"
|
356 |
exit
|
357 |
;;
|
358 |
esac
|
359 |
|
360 |
|
361 |
dailySkim=$HEDS_NAMEPREFIX$HEDS_LABEL-v$HEDS_TASKATTEMPT
|
362 |
crab -publish -c $HEDS_LOCALSTORE/$dailySkim
|
363 |
if((! $?)); then
|
364 |
heds.sh 4c #copy file from the SE
|
365 |
else
|
366 |
exit 1
|
367 |
fi
|
368 |
#heds.sh 4c_temp #copy file from the SE manually using scp
|
369 |
|
370 |
if ((! $?));
|
371 |
then
|
372 |
cat >> status <<EOF
|
373 |
get
|
374 |
EOF
|
375 |
fi
|
376 |
cd $initialFolder
|
377 |
;;
|
378 |
|
379 |
|
380 |
tables) ### produce html tables
|
381 |
hedsTaskFolder=$2
|
382 |
rawLocation=$3
|
383 |
if [ -z "$hedsTaskFolder" -o ! -d ./$hedsTaskFolder ]; then
|
384 |
echo -e "+++ ERROR: you have to specify a \"hedsTaskFolder\" as in: "
|
385 |
echo " heds.sh tables <hedsTaskFolder>"
|
386 |
exit 1
|
387 |
fi
|
388 |
source ./$hedsTaskFolder/configuration
|
389 |
cd $HEDS_LOCALSTORE
|
390 |
status=`tail -n1 status`
|
391 |
echo "status: " $status
|
392 |
if [[ !("$status" == "merge") && !("$status" == "submit_empty") ]];then
|
393 |
echo "+++ ERROR: you may have to retrieve crab jobs first. Try:"
|
394 |
echo " heds status <taskFolder>"
|
395 |
exit 1
|
396 |
fi
|
397 |
|
398 |
|
399 |
if [ -d $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION ]; then
|
400 |
echo "Warning: " logs.SkimV$HEDS_SKIMVERSION " already exist in final WWW_AREA."
|
401 |
echo "Copying base html tables from there."
|
402 |
|
403 |
##TO BE FIXED. Check that files exist before copy
|
404 |
cp $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/FirstPage.php \
|
405 |
$HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/
|
406 |
cp $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/tableHeader.shtm \
|
407 |
$HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/
|
408 |
cp $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/tableBody.shtm \
|
409 |
$HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/
|
410 |
fi
|
411 |
|
412 |
if [ -z "$rawLocation" ];then
|
413 |
rawLocation=below
|
414 |
fi
|
415 |
|
416 |
if [ "$status" == "merge" ]; then
|
417 |
heds.sh 4a #copy all logs file
|
418 |
heds.sh store . #copy zipped edm file and crab logs
|
419 |
heds.sh 4b #making skim report
|
420 |
heds.sh 4f #list of skimmed events
|
421 |
heds.sh 4g #copy logs about run selection
|
422 |
heds.sh 4h #preparing event dumps
|
423 |
heds.sh 4i $rawLocation #preparing final html tables
|
424 |
fi
|
425 |
|
426 |
if [ "$status" == "submit_empty" ]; then
|
427 |
heds.sh 4g #copy logs about run selection
|
428 |
heds.sh 4i2 $rawLocation #preparing final html tables
|
429 |
fi
|
430 |
|
431 |
cat >> status <<EOF
|
432 |
tables
|
433 |
EOF
|
434 |
cd $initialFolder
|
435 |
;;
|
436 |
|
437 |
merge) ### merge files before copying them to castor area
|
438 |
hedsTaskFolder=$2
|
439 |
if [ -z "$hedsTaskFolder" -o ! -d ./$hedsTaskFolder ]; then
|
440 |
echo -e "+++ ERROR: you have to specify a \"hedsTaskFolder\" as in: "
|
441 |
echo " heds.sh tables <hedsTaskFolder>"
|
442 |
exit 1
|
443 |
fi
|
444 |
source ./$hedsTaskFolder/configuration
|
445 |
cd $HEDS_LOCALSTORE
|
446 |
status=`grep "crab_done" status`
|
447 |
if [ -z "$status" ];then
|
448 |
echo "+++ ERROR: crab jobs are not done yet. Try:"
|
449 |
echo " heds status <taskFolder>"
|
450 |
exit 1
|
451 |
fi
|
452 |
|
453 |
heds.sh 4d #merging edm files
|
454 |
|
455 |
cat >> status <<EOF
|
456 |
merge
|
457 |
EOF
|
458 |
cd $initialFolder
|
459 |
;;
|
460 |
|
461 |
|
462 |
|
463 |
store) ### produce html tables
|
464 |
hedsTaskFolder=$2
|
465 |
if [ -z "$hedsTaskFolder" -o ! -d ./$hedsTaskFolder ]; then
|
466 |
echo -e "+++ ERROR: you have to specify a \"hedsTaskFolder\" as in: "
|
467 |
echo " heds.sh tables <hedsTaskFolder>"
|
468 |
exit 1
|
469 |
fi
|
470 |
source ./$hedsTaskFolder/configuration
|
471 |
cd $HEDS_LOCALSTORE
|
472 |
status=`grep "crab_done" status`
|
473 |
if [ -z "$status" ];then
|
474 |
echo "+++ ERROR: crab jobs are not done yet. Try:"
|
475 |
echo " heds status <taskFolder>"
|
476 |
exit 1
|
477 |
fi
|
478 |
|
479 |
### create CASTOR folder
|
480 |
nsls -d $HEDS_CASTORFOLDER/skimV$HEDS_SKIMVERSION >& tmp
|
481 |
check=`cat tmp |grep "No such" |wc -w`
|
482 |
rm tmp
|
483 |
if [ $check == 0 ]
|
484 |
then echo "directory " $HEDS_CASTORFOLDER/skimV$HEDS_SKIMVERSION "already exists"
|
485 |
else
|
486 |
echo "making " $HEDS_CASTORFOLDER/skimV$HEDS_SKIMVERSION " directory"
|
487 |
rfmkdir -p $HEDS_CASTORFOLDER/skimV$HEDS_SKIMVERSION
|
488 |
fi
|
489 |
|
490 |
heds.sh 6 #copy merged log files in CASTOR
|
491 |
heds.sh 4e #copy merged edm files in CASTOR
|
492 |
# cat >> status <<EOF
|
493 |
#store
|
494 |
#EOF
|
495 |
cd $initialFolder
|
496 |
;;
|
497 |
|
498 |
preview) ### produce html tables
|
499 |
hedsTaskFolder=$2
|
500 |
if [ -z "$hedsTaskFolder" -o ! -d ./$hedsTaskFolder ]; then
|
501 |
echo -e "+++ ERROR: you have to specify a \"hedsTaskFolder\" as in: "
|
502 |
echo " heds.sh tables <hedsTaskFolder>"
|
503 |
exit 1
|
504 |
fi
|
505 |
source ./$hedsTaskFolder/configuration
|
506 |
|
507 |
initialFolder=`pwd`
|
508 |
cd $HEDS_LOCALSTORE
|
509 |
heds.sh 4j #
|
510 |
php $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/FirstPage.php > FirstPage.html
|
511 |
mv FirstPage.html $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/
|
512 |
cp $HEDS_WWWAREA/fromGiovanni.css $HEDS_WWWAREA_TMP
|
513 |
cat >> status <<EOF
|
514 |
preview
|
515 |
EOF
|
516 |
cd $initialFolder
|
517 |
;;
|
518 |
|
519 |
add2Web) ### produce html tables
|
520 |
hedsTaskFolder=$2
|
521 |
if [ -z "$hedsTaskFolder" -o ! -d ./$hedsTaskFolder ]; then
|
522 |
echo -e "+++ ERROR: you have to specify a \"hedsTaskFolder\" as in: "
|
523 |
echo " heds.sh tables <hedsTaskFolder>"
|
524 |
exit 1
|
525 |
fi
|
526 |
source ./$hedsTaskFolder/configuration
|
527 |
|
528 |
initialFolder=`pwd`
|
529 |
cd $HEDS_LOCALSTORE
|
530 |
heds.sh final #
|
531 |
cat >> status <<EOF
|
532 |
add2Web
|
533 |
EOF
|
534 |
cd $initialFolder
|
535 |
;;
|
536 |
|
537 |
|
538 |
|
539 |
|
540 |
########## internal "functions" which are not meant to be used by users ###############
|
541 |
0)
|
542 |
echo "=== Setting up directories and one-time things ==="
|
543 |
echo ""
|
544 |
|
545 |
### create WWW folders
|
546 |
if [ -d $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION ]
|
547 |
then echo "directory " $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION \
|
548 |
" already exists. Then skipping \"mkdir\" "
|
549 |
|
550 |
if [ ! -d $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents ]; then
|
551 |
echo "making " $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents
|
552 |
mkdir -p $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents
|
553 |
fi
|
554 |
|
555 |
else
|
556 |
echo "making " $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION " directory"
|
557 |
mkdir -p $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/
|
558 |
|
559 |
if [ -d $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION ]; then
|
560 |
echo "Warning: " logs.SkimV$HEDS_SKIMVERSION " already exist in final WWW_AREA."
|
561 |
echo "Copying base html tables from there."
|
562 |
|
563 |
##TO BE FIXED. Check that files exist before copy
|
564 |
cp $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/FirstPage.php \
|
565 |
$HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/
|
566 |
cp $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/tableHeader.shtm \
|
567 |
$HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/
|
568 |
cp $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/tableBody.shtm \
|
569 |
$HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/
|
570 |
fi
|
571 |
|
572 |
if [ ! -d $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents ]; then
|
573 |
echo "making " $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents
|
574 |
mkdir -p $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents
|
575 |
fi
|
576 |
fi
|
577 |
;;
|
578 |
|
579 |
1)
|
580 |
echo "=== you selected option 1. Querying RunRegistry, select good runs and submit crab jobs ==="
|
581 |
echo ""
|
582 |
|
583 |
dateForDbsSearch=`echo $HEDS_LABEL|awk -F\. '{print $3"-"$2"-"$1}'`
|
584 |
#echo "dateForDbsSearch: " $dateForDbsSearch
|
585 |
dbs search --query="find run where dataset=$HEDS_INPUTDATASET and run.createdate=$dateForDbsSearch" \
|
586 |
> tmpRunList.txt
|
587 |
lastRun=`cat tmpRunList.txt |grep [0-9][0-9][0-9][0-9][0-9][0-9] |head -n1`
|
588 |
firstRun=`cat tmpRunList.txt|grep [0-9][0-9][0-9][0-9][0-9][0-9] |tail -n1`
|
589 |
|
590 |
|
591 |
if((!${#lastRun}));then
|
592 |
rm tmpRunList.txt
|
593 |
echo "no runs" > $HEDS_LABEL.runinterval
|
594 |
|
595 |
echo "No input runs for"
|
596 |
echo "HEDS_LABEL=" $HEDS_LABEL
|
597 |
echo "and"
|
598 |
echo "HEDS_INPUTDATASET=" $HEDS_INPUTDATASET
|
599 |
echo ""
|
600 |
|
601 |
echo "No CRAB cfg will be created."
|
602 |
cat >> status <<EOF
|
603 |
runselection_empty
|
604 |
EOF
|
605 |
exit 0
|
606 |
fi
|
607 |
|
608 |
rm tmpRunList.txt
|
609 |
echo "first,last runs: " $firstRun $lastRun
|
610 |
|
611 |
|
612 |
runselection="runselection="
|
613 |
cat $HEDSPATH/scripts/runreg.cfg | sed s/SET_RUNMIN/$firstRun/ | \
|
614 |
sed s/SET_RUNMAX/$lastRun/ > runreg.cfg
|
615 |
python $HEDSPATH/scripts/runregparse.py > tmp.log
|
616 |
rm runreg.cfg
|
617 |
echo "here we have the good run list"
|
618 |
|
619 |
IFS=$'\n'
|
620 |
found=0
|
621 |
lastGoodRun=0
|
622 |
for line in $(cat tmp.log);
|
623 |
do
|
624 |
if [ $found == 0 ]
|
625 |
then
|
626 |
found=`echo $line |grep lumisToProcess|wc |awk '{print $1}'`
|
627 |
continue;
|
628 |
fi
|
629 |
if [ $line == ")" ]
|
630 |
then
|
631 |
break;
|
632 |
fi
|
633 |
thisRun=`echo $line | sed s/\'//g | sed s/,//g |awk -F: '{print $1}'`
|
634 |
if [ $thisRun != $lastGoodRun ]
|
635 |
then
|
636 |
runselection=$runselection$thisRun\,
|
637 |
fi
|
638 |
lastGoodRun=$thisRun
|
639 |
done
|
640 |
#echo "========= THE FOLLOWING LINE TO YOUR crab.cfg FILE ========="
|
641 |
echo $runselection
|
642 |
#echo "================================================================"
|
643 |
echo $runselection > $HEDS_LABEL.runselection
|
644 |
echo $firstRun-$lastRun > $HEDS_LABEL.runinterval
|
645 |
rm tmp.log
|
646 |
|
647 |
check=`echo $runselection | sed s/runselection=// |wc -w`
|
648 |
|
649 |
if [ $check == 0 ]
|
650 |
then
|
651 |
echo "No good runs have been selected. No CRAB cfg will be created."
|
652 |
cat >> status <<EOF
|
653 |
runselection_empty
|
654 |
EOF
|
655 |
else
|
656 |
echo "Some good runs have been selected. CRAB cfg will be created."
|
657 |
cat >> status <<EOF
|
658 |
runselection_done
|
659 |
EOF
|
660 |
cat $HEDSPATH/scripts/crab.template.cfg |sed "s#SET_DATASET#$HEDS_INPUTDATASET#" | \
|
661 |
# sed "s#SET_REMOTEDIR#$HEDS_USERID/HEDS/#" | \
|
662 |
sed "s#SET_REMOTEDIR#$HEDS_USERID/#" | \
|
663 |
sed "s#SET_T2#$HEDS_T2SITE#" | \
|
664 |
sed "s/SET_RUNSELECTION/$runselection/" > tmp.cfg
|
665 |
pset=$HEDSPATH/python/earlyDataInterestingEvents_cfg.py
|
666 |
echo "pset: " $pset
|
667 |
cat tmp.cfg |sed s#SET_PSET#$pset# | sed "s#SET_TASK_NAME#$dailySkim#" > tmp2.cfg; rm tmp.cfg
|
668 |
mv tmp2.cfg $HEDS_LABEL.crab.cfg
|
669 |
fi
|
670 |
;;
|
671 |
2)
|
672 |
status=`tail -n1 status`
|
673 |
if [ ! "$status" == "runselection_done" ];then
|
674 |
#no crab jobs to be submitted
|
675 |
cat >> status <<EOF
|
676 |
submit_empty
|
677 |
EOF
|
678 |
exit 0
|
679 |
fi
|
680 |
|
681 |
echo "creating and submitting CRAB jobs for " $dailySkim
|
682 |
|
683 |
if [ -e $HEDS_LABEL.crab.cfg ]
|
684 |
then
|
685 |
crab -create -submit -cfg $HEDS_LABEL.crab.cfg
|
686 |
if ((! $?)); then
|
687 |
#crab jobs successfully submitted
|
688 |
rm $HEDS_LABEL.crab.cfg;
|
689 |
else
|
690 |
#crab jobs were NOT submitted
|
691 |
echo -e "\n"
|
692 |
echo -e "+++ Crab jobs haven't been submitted correctly."
|
693 |
echo -e " You have to repeat the \"heds submit <task_folder>\" step."
|
694 |
#doing some cleaning before exiting
|
695 |
if [ -d ./$dailySkim ]; then
|
696 |
echo "removing crab folder"
|
697 |
rm -r ./$dailySkim; fi
|
698 |
exit 1
|
699 |
fi
|
700 |
cat >> status <<EOF
|
701 |
submit
|
702 |
EOF
|
703 |
else
|
704 |
echo "ERROR: " $HEDS_LABEL.crab.cfg " doesn't exist"
|
705 |
fi
|
706 |
;;
|
707 |
3)
|
708 |
echo "getting output and publishing crab jobs"
|
709 |
crab -status -c $dailySkim &> /dev/null
|
710 |
crab -get -c $dailySkim
|
711 |
crab -status -c $dailySkim &> /dev/null
|
712 |
crab -publish -c $dailySkim
|
713 |
;;
|
714 |
|
715 |
|
716 |
4)
|
717 |
echo "option 4 "
|
718 |
if [ -d $dailySkim ] #the crab job was run on at least 1 run
|
719 |
then
|
720 |
heds 4a
|
721 |
heds 4b
|
722 |
heds 4c
|
723 |
heds 4d
|
724 |
heds 4e
|
725 |
heds 4f
|
726 |
heds 4g
|
727 |
heds 4h
|
728 |
heds 4i
|
729 |
else
|
730 |
echo "copying only the log files about runs and selected-runs"
|
731 |
heds 4g
|
732 |
heds 4i2
|
733 |
fi
|
734 |
;;
|
735 |
|
736 |
4a)
|
737 |
#### echo "...copying log files"
|
738 |
if [ ! -d $HEDS_LOCALSTORE/$dailySkim/logs ]; then
|
739 |
mkdir -p $HEDS_LOCALSTORE/$dailySkim/logs
|
740 |
fi
|
741 |
cp $dailySkim/res/*.std* $HEDS_LOCALSTORE/$dailySkim/logs
|
742 |
if (($?)); then
|
743 |
echo "ERROR: failed to copy log files in " $HEDS_LOCALSTORE/$dailySkim/logs;
|
744 |
else
|
745 |
echo "copied all logs file in " $HEDS_LOCALSTORE/$dailySkim/logs
|
746 |
fi
|
747 |
|
748 |
###
|
749 |
tarName=$HEDS_LABEL.log.tgz
|
750 |
cd $HEDS_LOCALSTORE/$dailySkim/logs/
|
751 |
if (($?));then
|
752 |
echo "ERROR: failed to go to " $HEDS_LOCALSTORE/$dailySkim/logs/
|
753 |
else
|
754 |
echo "compriming log files... "
|
755 |
tar czvf $tarName *.std* >& /dev/null
|
756 |
echo -e "done \n"
|
757 |
cd -
|
758 |
fi
|
759 |
;;
|
760 |
|
761 |
4b)
|
762 |
###
|
763 |
echo -e "creating skimReport..."
|
764 |
logName=$HEDS_LABEL.log
|
765 |
$HEDSPATH/scripts/skimreport $HEDS_LOCALSTORE/$dailySkim/logs/*.stdout > $logName
|
766 |
cp $logName $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents/
|
767 |
echo -e "done \n"
|
768 |
;;
|
769 |
|
770 |
4c)
|
771 |
###
|
772 |
echo "...coping files from the T2's SE"
|
773 |
echo "dataset to retreive: " $dailySkim
|
774 |
dbs search --url=https://cmsdbsprod.cern.ch:8443/cms_dbs_ph_analysis_02_writer/servlet/DBSServlet \
|
775 |
--query="find file,site where dataset=*$dailySkim*" |grep .root >listFiles
|
776 |
|
777 |
IFS=$'\n'
|
778 |
for j in $(cat listFiles)
|
779 |
do
|
780 |
echo "going to copy file: $j"
|
781 |
fileName=`echo $j |awk '{print$1}'| awk -F$dailySkim/ '{print $2}' | awk -F/ '{print $2}'`
|
782 |
|
783 |
storage_elem=`echo $j |awk '{print $2}'`
|
784 |
remote_path=`echo $j|awk '{print $1}'`
|
785 |
lcg-cp -b -D srmv2 srm://$storage_elem:$HEDS_STORAGEPORT$HEDS_STORAGEPATH$remote_path file://$HEDS_LOCALSTORE/$dailySkim/$fileName
|
786 |
done
|
787 |
rm listFiles
|
788 |
#nFiles=`ls $HEDS_LOCALSTORE/$dailySkim/*.root|wc -l`
|
789 |
#nJobs=`ls $HEDS_LOCALSTORE/$dailySkim/logs/CMSSW_*.stdout |wc -l`
|
790 |
;;
|
791 |
|
792 |
4c_temp)
|
793 |
echo "copying manually files from SE.. "
|
794 |
scp bmangano@uaf-6.t2.ucsd.edu:/hadoop/cms/store/user/mangano/MinimumBias/$dailySkim/*/*.root $HEDS_LOCALSTORE/$dailySkim/
|
795 |
;;
|
796 |
|
797 |
|
798 |
4d)
|
799 |
###
|
800 |
echo -e "Merging files edm files..."
|
801 |
cp $HEDSPATH/scripts/prepareMerging.sh $HEDS_LOCALSTORE/$dailySkim
|
802 |
cp $HEDSPATH/scripts/merge.py $HEDS_LOCALSTORE/$dailySkim
|
803 |
cd $HEDS_LOCALSTORE/$dailySkim
|
804 |
|
805 |
mergedName=$HEDS_LABEL.root
|
806 |
mergedName=merged_$mergedName
|
807 |
|
808 |
./prepareMerging.sh
|
809 |
numberFilesToMerge=`ls *.root|wc -l`
|
810 |
echo "numberFilesToMerge: " $numberFilesToMerge
|
811 |
cmsRun merge.py >& merging.log
|
812 |
mv merged.root $HEDS_LOCALSTORE/$mergedName
|
813 |
echo -e "done \n"
|
814 |
cd -
|
815 |
;;
|
816 |
|
817 |
4e)
|
818 |
###
|
819 |
echo -e "Storing merged edm file in CASTOR..."
|
820 |
mergedName=$HEDS_LABEL.root
|
821 |
mergedName=merged_$mergedName
|
822 |
echo "mergedName: " $mergedName
|
823 |
cd $HEDS_LOCALSTORE/$dailySkim
|
824 |
if ((! $?)); then
|
825 |
echo "going to copy the merged file into: " $HEDS_CASTORFOLDER/skimV$HEDS_SKIMVERSION
|
826 |
rfcp $HEDS_LOCALSTORE/$mergedName $HEDS_CASTORFOLDER/skimV$HEDS_SKIMVERSION/
|
827 |
cd -
|
828 |
fi
|
829 |
echo -e "done \n"
|
830 |
;;
|
831 |
|
832 |
4f)
|
833 |
###
|
834 |
echo "Preparing detailed list of skimmed events..."
|
835 |
cp $HEDSPATH/scripts/listSkimmedEvent.C $HEDS_LOCALSTORE
|
836 |
cd $HEDS_LOCALSTORE
|
837 |
forRootExecution="listSkimmedEvent.C++(\"${HEDS_LABEL}\")"
|
838 |
|
839 |
root.exe -b -q $forRootExecution >& /dev/null
|
840 |
listSkimmedEventsPath=$HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents
|
841 |
if [ ! -d $listSkimmedEventsPath ]
|
842 |
then
|
843 |
mkdir $listSkimmedEventsPath
|
844 |
fi
|
845 |
listDetailedLogs=`ls ${HEDS_LABEL}_Skim_*`
|
846 |
for j in $listDetailedLogs
|
847 |
do
|
848 |
echo "preparing log " $j
|
849 |
# sort entries by date
|
850 |
cat $j |sort -k7 > tmp
|
851 |
mv tmp $j
|
852 |
mv $j $listSkimmedEventsPath
|
853 |
done
|
854 |
echo -e "done \n"
|
855 |
cd -
|
856 |
;;
|
857 |
|
858 |
4g)
|
859 |
###
|
860 |
echo "Copying logs about run selection..."
|
861 |
cp $HEDS_LABEL.runselection $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents
|
862 |
cp $HEDS_LABEL.runinterval $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents
|
863 |
echo -e "done \n"
|
864 |
;;
|
865 |
|
866 |
4h)
|
867 |
###
|
868 |
echo "Preparing event dumps..."
|
869 |
input=$HEDS_LOCALSTORE/merged_$HEDS_LABEL.root
|
870 |
echo "input: " $input
|
871 |
sed s#INPUT#$input# $HEDSPATH/scripts/dumpEvent.py > dumpEvent.py
|
872 |
cmsRun dumpEvent.py >& $HEDS_LABEL.dumperLog
|
873 |
|
874 |
$HEDSPATH/scripts/parseDumperOutput.sh 1 >& $HEDS_LABEL.dump
|
875 |
$HEDSPATH/scripts/parseDumperOutput.sh 2
|
876 |
rm dumpEvent.py
|
877 |
rm $HEDS_LABEL.dumperLog
|
878 |
rm $HEDS_LABEL.dump
|
879 |
echo -e "done \n"
|
880 |
;;
|
881 |
4i)
|
882 |
###
|
883 |
rawLocation=$2
|
884 |
echo "Preparing html tables..."
|
885 |
if [ ! -e $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/FirstPage.php ];then
|
886 |
echo "create first version of FirstTable.sh"
|
887 |
$HEDSPATH/scripts/editFirstTable.sh create
|
888 |
$HEDSPATH/scripts/createTableSkimDetails.sh add ; echo "level-3 tables produced"
|
889 |
$HEDSPATH/scripts/createTableSkimSummary.sh ; echo "level-2 tables produced"
|
890 |
$HEDSPATH/scripts/editFirstTable.sh add $rawLocation ; echo "level-1 table modified"
|
891 |
else
|
892 |
$HEDSPATH/scripts/createTableSkimDetails.sh clean; echo "clean up old html tables"
|
893 |
$HEDSPATH/scripts/createTableSkimDetails.sh add ; echo "level-3 tables produced"
|
894 |
$HEDSPATH/scripts/createTableSkimSummary.sh ; echo "level-2 tables produced"
|
895 |
$HEDSPATH/scripts/editFirstTable.sh add $rawLocation ; echo "level-1 table modified"
|
896 |
fi
|
897 |
echo -e "done \n"
|
898 |
;;
|
899 |
|
900 |
4i2)
|
901 |
###
|
902 |
rawLocation=$2
|
903 |
echo "Preparing html tables..."
|
904 |
if [ ! -e $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/FirstPage.php ];then
|
905 |
echo "create first version of FirstTable.sh"
|
906 |
$HEDSPATH/scripts/editFirstTable.sh create
|
907 |
#$HEDSPATH/scripts/createTableSkimDetails.sh add ; echo "level-3 tables produced"
|
908 |
#$HEDSPATH/scripts/createTableSkimSummary.sh ; echo "level-2 tables produced"
|
909 |
$HEDSPATH/scripts/editFirstTable.sh addSpecial $rawLocation ; echo "level-1 table modified"
|
910 |
else
|
911 |
#$HEDSPATH/scripts/createTableSkimDetails.sh clean; echo "clean up old html tables"
|
912 |
#$HEDSPATH/scripts/createTableSkimDetails.sh add ; echo "level-3 tables produced"
|
913 |
#$HEDSPATH/scripts/createTableSkimSummary.sh ; echo "level-2 tables produced"
|
914 |
$HEDSPATH/scripts/editFirstTable.sh addSpecial $rawLocation ; echo "level-1 table modified"
|
915 |
fi
|
916 |
echo -e "done \n"
|
917 |
;;
|
918 |
|
919 |
|
920 |
4j) ###
|
921 |
echo -e "Your preliminary table is available at the following URL: "
|
922 |
url="file://"
|
923 |
url=$url$HEDS_WWWAREA_TMP"/logs.SkimV$HEDS_SKIMVERSION/FirstPage.html"
|
924 |
echo -e $url "\n"
|
925 |
|
926 |
echo -e "After you verified that all the tables have been correctly produced, " \
|
927 |
"they can be moved to the final repository using:"
|
928 |
echo -e " heds add2Web <taskFolder> \n"
|
929 |
|
930 |
|
931 |
echo "WARNING: if some php pages are not opened corretly, it may be because apache server is not"
|
932 |
echo " running on the machine hosting your HEDS_WWWAREA_TMP area."
|
933 |
echo "In such a case, copy the whole HEDS_WWWAREA_TMP where "
|
934 |
echo "php can be interpreted correctly: e.g. your personal webSite hosted at CERN "
|
935 |
echo ""
|
936 |
echo "To remind you, currently your HEDS_WWWAREA_TMP folder is: "
|
937 |
echo $HEDS_WWWAREA_TMP
|
938 |
|
939 |
;;
|
940 |
|
941 |
|
942 |
6) ### copying stuff to castor
|
943 |
tarName=$HEDS_LABEL.log.tgz
|
944 |
cd $HEDS_LOCALSTORE/$dailySkim/logs/
|
945 |
if (($?));then
|
946 |
echo "ERROR: failed to go to " $HEDS_LOCALSTORE/$dailySkim/logs/
|
947 |
else
|
948 |
echo "copying " $tarName " file to CASTOR area.."
|
949 |
rfcp $tarName $HEDS_CASTORFOLDER/skimV$HEDS_SKIMVERSION
|
950 |
echo -e "done \n"
|
951 |
cd -
|
952 |
fi
|
953 |
;;
|
954 |
|
955 |
5a)
|
956 |
echo ".... preparing event display server"
|
957 |
mkdir $HEDS_LABEL.shots
|
958 |
port=3005
|
959 |
$HEDSPATH/scripts/eventDisplayServer.sh $port &
|
960 |
;;
|
961 |
5b)
|
962 |
echo "getting snapshots"
|
963 |
port=3005
|
964 |
file=$HEDS_LOCALSTORE/merged_$HEDS_LABEL.root
|
965 |
echo "$file" | nc -w 10 localhost $port
|
966 |
;;
|
967 |
5c)
|
968 |
echo "moving snapshots"
|
969 |
mv $HEDS_LABEL.shots $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/
|
970 |
cp $HEDSPATH/scripts/indexFileForDetailedSnapShots.php \
|
971 |
$HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.shots/index.php
|
972 |
;;
|
973 |
|
974 |
|
975 |
final)
|
976 |
#TO BE FIXED. this call could written in a much more compact way
|
977 |
echo "WWW pages are going to be moved from the temporary repository"
|
978 |
echo -e "("$HEDS_WWWAREA_TMP")\n"
|
979 |
echo "to the permanent one"
|
980 |
echo -e "("$HEDS_WWWAREA")\n"
|
981 |
|
982 |
if [ ! -d $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION ]; then
|
983 |
mkdir $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION
|
984 |
fi
|
985 |
|
986 |
if [ -e $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/FirstPage.php ]; then
|
987 |
cp $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/FirstPage.php \
|
988 |
$HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/FirstPage.php.BAK
|
989 |
fi
|
990 |
if [ -e $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/tableBody.shtm ]; then
|
991 |
cp $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/tableBody.shtm \
|
992 |
$HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/tableBody.shtm.BAK
|
993 |
fi
|
994 |
if [ -e $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/tableHeader.php ]; then
|
995 |
cp $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/tableHeader.shtm \
|
996 |
$HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/tableHeader.shtm.BAK
|
997 |
fi
|
998 |
|
999 |
cp $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/*.php \
|
1000 |
$HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/
|
1001 |
cp $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/*.shtm \
|
1002 |
$HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/
|
1003 |
|
1004 |
if [ -e $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents ]; then
|
1005 |
if [ -e $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents ]; then
|
1006 |
echo "WARNING: replacing folder in the official AFS area of the HiggsDQM."
|
1007 |
|
1008 |
echo "Do you know what you are doing? And is this what you really want to do? [y/n]"
|
1009 |
read -p "$prompt" answer
|
1010 |
case "$answer" in
|
1011 |
[yY1] )
|
1012 |
echo "proceeding with the update of the table.."
|
1013 |
;;
|
1014 |
[nN0] )
|
1015 |
exit 0
|
1016 |
;;
|
1017 |
*)
|
1018 |
echo -e "Incorrect answer. Assuming you meant to type \"No\" "
|
1019 |
exit
|
1020 |
;;
|
1021 |
esac
|
1022 |
rm -r -i $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents
|
1023 |
fi
|
1024 |
cp -r $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents \
|
1025 |
$HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents
|
1026 |
fi
|
1027 |
|
1028 |
|
1029 |
url="https://cms-project-higgsdqm.web.cern.ch/cms-project-higgsdqm/HiggsEDS"
|
1030 |
url=$url"/logs.SkimV$HEDS_SKIMVERSION/FirstPage.php"
|
1031 |
|
1032 |
echo "The new tables created by you are accessible through the following URL: "
|
1033 |
echo $url
|
1034 |
;;
|
1035 |
|
1036 |
##################### after the crab part is done ###################
|
1037 |
99) echo "Doing bakcup of $HEDS_WWWAREA_TMP"
|
1038 |
date=`date +%k\.%M\.%S_%e\.%m\.%Y`
|
1039 |
fileName="HiggsIES.BAK."$date".tgz"
|
1040 |
echo "file name: " $fileName
|
1041 |
tar -czvf $fileName $HEDS_WWWAREA_TMP
|
1042 |
mv $fileName $HEDS_WWWAREA_TMP/..
|
1043 |
;;
|
1044 |
|
1045 |
help)
|
1046 |
heds --help
|
1047 |
;;
|
1048 |
|
1049 |
|
1050 |
--help)
|
1051 |
printf '%-30.30s -- %s\n\n' " heds up" "Create a predefined configuration file (heds.cfg) in the current directory"
|
1052 |
|
1053 |
printf '%-30.30s -- %s\n\n' " heds create <heds.cfg>" "Prepare heds environment and save it into a new taskFolder"
|
1054 |
|
1055 |
printf '%-30.30s -- %s\n\n' " heds submit <taskFolder>" "Query runregistry for list of good runs and submit crab jobs"
|
1056 |
|
1057 |
printf '%-30.30s -- %s\n\n' " heds get <taskFolder>" "Retrieve skimmed files from T2's SE"
|
1058 |
|
1059 |
printf '%-30.30s -- %s\n\n' " heds merge <taskFolder>" "Merge skimmed edm files into a single one"
|
1060 |
|
1061 |
printf '%-30.30s -- %s\n' " heds tables <taskFolder>" "Produce the html tables with all the relevant information about the skimmed events. "
|
1062 |
printf '%-33.33s %s\n\n' " " "Also Save skimmed file in CASTOR."
|
1063 |
|
1064 |
printf '%-30.30s -- %s\n\n' " heds preview <taskFolder>" "Return URL to the html tables for reviewing them before uploading into the final repository"
|
1065 |
|
1066 |
printf '%-30.30s -- %s\n\n' " heds add2Web <taskFolder>" "Upload the html tables and the correlated files into the permanent AFS repository"
|
1067 |
|
1068 |
printf '%-30.30s -- %s\n\n' " heds status <taskFolder>" "Return the current status of the heds task. Guide the user into the next step of heds that has to be executed"
|
1069 |
;;
|
1070 |
|
1071 |
|
1072 |
*)
|
1073 |
echo -e "+++ You cannot call heds without argument. Here is the list of possible choices: \n"
|
1074 |
heds --help
|
1075 |
;;
|
1076 |
esac |