-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathlsfOneMatrix.sh
executable file
·128 lines (107 loc) · 3.51 KB
/
lsfOneMatrix.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/bash
##########################################
#
# example submission
#
# bsub -q 8nh -R "type==SLC6_64" ~/lsfOneMatrix.sh -rb CMSSW_ABCDE -te pass-1 -wf 10024.0 -wfCMD " --customise AAOO.py" -o cmsdev02
#
##########################################
shopt -s expand_aliases
iAll=""
j0=""
wUp=""
toEos=0
toDev2=0
while [ X$# != X0 ] ; do
case ${1} in
-rb) shift; relBase=$1; shift;;
-te) shift; testExt=$1; shift;;
-wf) shift; wf=$1; shift;;
-iAll) shift; iAll="-i all";;
-wUp) shift; wUp="-w upgrade";;
-wfCMD) shift; wfCMD="${1}"; shift;;
-o) shift;
case ${1} in
eos) toEos=1; echo will write to eos; shift;;
cmsdev02) toDev2=1; echo will write to dev02; dHost=cmsdev02; shift;;
*) shift; echo "unknown destination (can have eos or cmsdev02)";;
esac
;;
-dry) shift; j0="-j 0";;
*) shift; echo unknown option ${1} ;;
esac
done
echo relBase ${relBase}
echo testExt ${testExt}
echo wf ${wf}
echo iAll ${iAll}
echo wUp ${wUp}
echo wfCMD "${wfCMD}"
echo j0 ${j0}
##########################################
# edit these to specialize
##########################################
# release base directory, the $CMSSW_BASE will be ${relDir}/${relBase}
relDir=/afs/cern.ch/work/U/USER/reltest
# eos output directory base: actual output will go to ${eosBase}/${relBase}/[${testExt}/] if eos is chosen
eosBase=/eos/cms/store/user/USER/reltest
# local node directory; cmsdev02 is currently hardcoded as the only option other than eos; edit dHost above to change
dev2base=/build/USER/reltest/lsf
##########################################
wDir=`pwd`
echo "Started from ${wDir} on "`uname -a`" at "`date`
cat /proc/cpuinfo | tail -30
relDir=${relDir}/${relBase}/src
[ -d "${relDir}" ] || (echo relDir ${relDir} is missing; exit 15 )
cd ${relDir}
eval `scramv1 ru -sh` || (echo failed to cmsenv in ${relDir}; exit 16 )
echo back to ${wDir}
cd ${wDir}
if [ "x${toEos}" == "x1" ]; then
source /afs/cern.ch/project/eos/installation/cms/etc/setup.sh
testOut=${eosBase}/${relBase}
eos ls ${testOut} >& /dev/null || ( echo make ${testOut}; eos mkdir ${testOut} )
eos ls ${testOut} >& /dev/null || ( echo failed to get ${testOut}; exit 17 )
if [ "x${testExt}" != "x" ]; then
testOut=${testOut}/${testExt}
eos ls ${testOut} >& /dev/null || ( echo make ${testOut}; eos mkdir ${testOut} )
fi
fi
if [ "x${toDev2}" == "x1" ]; then
testOut=${dev2base}/${relBase}
ssh ${dHost} " [ -d ${testOut} ] || mkdir -p ${testOut} "
if [ "x${testExt}" != "x" ]; then
testOut=${testOut}/${testExt}
ssh ${dHost} " [ -d ${testOut} ] || mkdir -p ${testOut} "
fi
fi
echo start matrix wf ${wf}
if [ "x${wfCMD}" == "x" ]; then
runTheMatrix.py -l ${wf} ${iAll} ${wUp} ${j0} >& run_${wf}.log
else
runTheMatrix.py -l ${wf} ${iAll} ${wUp} ${j0} --command="${wfCMD}" >& run_${wf}.log
fi
echo done with runTheMatrix.py at `date`
ls -ltrh
ls -ltrh ${wf}_*/
if [ "x${toEos}" == "x1" ]; then
eos cp run_${wf}.log ${testOut}/run_${wf}.log
fi
if [ "x${toDev2}" == "x1" ]; then
rsync -avz run_${wf}.log ${dHost}:${testOut}/run_${wf}.log
fi
oDir=`echo ${wf}_*`
if [ -d "${oDir}" ]; then
lOdir=${PWD}/${oDir}
if [ "x${toEos}" == "x1" ]; then
eOdir=${testOut}/${oDir}
echo "done running: output is in ${oDir} of size " `du -cksh ${oDir}`" to be copied to ${eOdir}"
eos ls ${eOdir} >& /dev/null || ( echo make ${eOdir}; eos mkdir ${eOdir} )
eos cp -r ${lOdir}/ ${eOdir}/
fi
if [ "x${toDev2}" == "x1" ]; then
rsync -avz ${lOdir}/ ${dHost}:${testOut}/${oDir}/
fi
fi
echo all done at `date`
exit 0