-
Notifications
You must be signed in to change notification settings - Fork 3
/
submit
executable file
·141 lines (104 loc) · 2.5 KB
/
submit
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
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/bin/bash
periods=(
"2016_preTS2"
"2016_postTS2"
"2017_preTS2"
"2017_postTS2"
"2018_preTS1"
"2018_TS1_TS2"
"2018_postTS2"
"2022"
)
#----------------------------------------------------------------------------------------------------
function Run()
{
echo "* $version"
# make version directory
mkdir -p "data/$version"
# make info file
(
echo "DATE:"
date
cd $CMSSW_BASE/src
echo ""
echo "--------------------------------------------------"
echo ""
echo "CMSSW base: $CMSSW_BASE"
echo ""
echo "CMSSW history:"
git log --oneline|head -n 3
echo ""
echo "CMSSW status:"
git st
echo ""
echo "--------------------------------------------------"
cd - &> /dev/null
echo ""
echo "This repo at:"
git log --oneline|head -n 3
echo ""
echo "This repo history:"
git st
) > "data/$version/info"
# initiate submission script
condor_file_sub="data/$version/condor.sub"
(
local base_dir_full="$(pwd)"
echo "executable = $base_dir_full/\$(dir)/job"
echo "arguments = \$(ClusterId) \$(ProcId) \\\"\$(dir)\\\""
echo "output = $base_dir_full/\$(dir)/out"
echo "error = $base_dir_full/\$(dir)/err"
echo "log = $base_dir_full/condor_${selection}.log"
echo "+MaxRuntime = 36000"
#echo "+JobBatchName = \"$job_name\""
#echo "requirements = (OpSysAndVer =?= \"SLCern6\")"
echo "requirements = (OpSysAndVer =?= \"CentOS7\")"
) > "$condor_file_sub"
# submit each period
for period in ${periods[*]}
do
echo " - $period"
dir="data/$version/$period"
full_dir="$(pwd -P)/data/$version/$period"
top_dir="$(pwd -P)"
# make and clean directory
mkdir -p "$dir"
cp -R templates/* "$dir"
cp settings/$period/* "$dir"
rm -f $dir/*.root
rm -f $dir/*.log
# make job script
cat "template_job" | sed "\
s|\$sw_dir|$CMSSW_BASE|g;\
s|\$job_dir|$full_dir|g;\
s|\$top_dir|$top_dir|g;\
s|\$version|$version|g;\
s|\$period|$period|g;\
" > "$dir/job"
chmod u+x "$dir/job"
# add submission line
(
echo ""
echo "dir=$dir"
echo "queue"
) >> "$condor_file_sub"
done
# submit
echo "In order to submit do:"
echo " condor_submit \"$condor_file_sub"\"
}
#----------------------------------------------------------------------------------------------------
function PrintUsage()
{
echo "USAGE: $0 <version>"
}
#----------------------------------------------------------------------------------------------------
make || exit 1
version="$1"
if [ -z "$version" ]
then
echo "ERROR: version not given"
PrintUsage
exit 1
fi
Run