CMSSW_frontier.sh 4.59 KB
Newer Older
Dong Liang's avatar
Dong Liang committed
1
#!/bin/bash
ericw's avatar
ericw committed
2
3
4
5
#
# Test of FroNtier under CMSSW
#
# Assumes:
ericw's avatar
ericw committed
6
#   1) environmental variables SAME_OK, SAME_WARNING and SAME_ERROR are defined
ericw's avatar
ericw committed
7
8
#   2) . $CMS_PATH/cmsset_default.sh has already been run
#
Andrea Sciaba's avatar
Andrea Sciaba committed
9
# $Id: CMSSW_frontier.sh,v 1.71 2012/10/24 13:33:10 asciaba Exp $
ericw's avatar
ericw committed
10
#
Stefano Belforte's avatar
Stefano Belforte committed
11
date
Dong Liang's avatar
Dong Liang committed
12
node=`uname -n`
13
printf "node: $node\n"
ericw's avatar
ericw committed
14
15
16
#
# Choose CMSSW version
#
17
cmsswvsn=CMSSW_9_0_0
ericw's avatar
ericw committed
18
#
19
#export SCRAM_ARCH=slc6_amd64_gcc491
ericw's avatar
ericw committed
20
21
22
23
24
25
26
27
# Check that environmental variable SAME_OK is set
#
if [ ! "${SAME_OK}" ]
then
   printf "CMSSW_frontier.sh: Error. SAME_OK not defined\n"
   exit 1
fi
#
ericw's avatar
ericw committed
28
# Check that environmental variable SAME_WARNING is set
29
#
ericw's avatar
ericw committed
30
if [ ! "${SAME_WARNING}" ]
31
then
ericw's avatar
ericw committed
32
   printf "CMSSW_frontier.sh: Error. SAME_WARNING not defined\n"
33
34
35
   exit 1
fi
#
36
37
38
39
40
41
42
43
# Check that environmental variable SAME_ERROR is set
#
if [ ! "${SAME_ERROR}" ]
then
   printf "CMSSW_frontier.sh: Error. SAME_ERROR not defined\n"
   exit 1
fi
#
ericw's avatar
ericw committed
44
45
# Print CMS_PATH
#
Andrea Sciaba's avatar
Andrea Sciaba committed
46
printf "CMS_PATH: $CMS_PATH\n"
ericw's avatar
ericw committed
47
#
ericw's avatar
ericw committed
48
49
50
51
52
53
54
55
56
57
# Check that scramv1 command was defined by . $CMS_PATH/cmsset_default.sh
#
type scramv1 > /dev/null 2>&1
sset=$?
if [ $sset -ne 0 ]
then 
   printf "CMSSW_frontier.sh: Error. scramv1 not found\n"
   exit $SAME_ERROR
fi
#
ericw's avatar
ericw committed
58
# Create Working Directory
ericw's avatar
ericw committed
59
#
ericw's avatar
ericw committed
60
61
mkdir frontier
cd frontier
ericw's avatar
ericw committed
62
current=`pwd`
ericw's avatar
ericw committed
63
printf "Current directory is: $current\n"
ericw's avatar
ericw committed
64
65
66
67
68
69
70
71
72
#
# Set up CMSSW 
#
printf "scramv1 project CMSSW $cmsswvsn ... starting\n"
scramv1 project CMSSW $cmsswvsn
scms=$?
if [ $scms -ne 0 ]
then
   printf "CMSSW_frontier.sh: Error. $cmsswvsn not available\n"
73
   exit $SAME_WARNING
ericw's avatar
ericw committed
74
75
76
77
78
79
80
81
82
83
84
fi
printf "scramv1 project CMSSW $cmsswvsn ... completed\n"
#
cd $cmsswvsn/src
printf "scramv1 runtime -sh ... starting\n"
eval `scramv1 runtime -sh | grep -v SCRAMRT_LSB_EXIT_REQUEUE | grep -v SCRAMRT_DOMAINNAME | grep -v SCRAMRT_LSB_JOBNAME`
printf "scramv1 runtime -sh ... completed\n"
#
# Return to working directory 
#
cd $current
Dong Liang's avatar
Dong Liang committed
85
ever_warning=0
Dong Liang's avatar
Dong Liang committed
86
# Execute squid test script
Andrea Sciaba's avatar
Andrea Sciaba committed
87
echo
Dong Liang's avatar
Dong Liang committed
88
echo "Executing the Squid test"
Dong Liang's avatar
Dong Liang committed
89
$SAME_SENSOR_HOME/tests/test_frontier.py 2>&1
Dong Liang's avatar
Dong Liang committed
90
91
92
resquid=$?
if [ $resquid -eq $SAME_ERROR ]
then 
Dong Liang's avatar
Dong Liang committed
93
	ever_warning=2
ericw's avatar
ericw committed
94
fi
Dong Liang's avatar
Dong Liang committed
95
96
97
if [ $resquid -eq $SAME_WARNING ]
then
	ever_warning=1
Dong Liang's avatar
Dong Liang committed
98
99
fi
	 
ericw's avatar
ericw committed
100
#
ericw's avatar
ericw committed
101
102
# Print out version
#
Andrea Sciaba's avatar
Andrea Sciaba committed
103
printf 'version: $Id: CMSSW_frontier.sh,v 1.71 2012/10/24 13:33:10 asciaba Exp $\n'
ericw's avatar
ericw committed
104
#
ericw's avatar
ericw committed
105
106
107
108
# Set environmenal variable for FroNtier
#
export FRONTIER_LOG_LEVEL=warning
#
ericw's avatar
ericw committed
109
110
# Create configuration file for cmsRun
#
111
112
/bin/cat > ecal_pedestals.py <<EOI
import FWCore.ParameterSet.Config as cms
ericw's avatar
ericw committed
113

114
115
116
117
118
119
120
121
process = cms.Process("TEST")
process.PoolDBESSource = cms.ESSource("PoolDBESSource",
    DBParameters = cms.PSet(
        messageLevel = cms.untracked.int32(0)
    ),
    timetype = cms.string('runnumber'),
    toGet = cms.VPSet(cms.PSet(
        record = cms.string('EcalPedestalsRcd'),
122
        tag = cms.string('EcalPedestals_mc')
123
    )),
124
    connect = cms.string('frontier://FrontierProd/CMS_CONDITIONS')
125
)
ericw's avatar
ericw committed
126

127
128
129
130
process.source = cms.Source("EmptySource",
    numberEventsInRun = cms.untracked.uint32(1),
    firstRun = cms.untracked.uint32(1)
)
ericw's avatar
ericw committed
131

132
process.maxEvents = cms.untracked.PSet(
133
    input = cms.untracked.int32(5)
134
)
135
136
process.get = cms.EDAnalyzer("EventSetupRecordDataGetter",
    verbose = cms.untracked.bool(True),
137
138
139
140
141
    toGet = cms.VPSet(cms.PSet(
        record = cms.string('EcalPedestalsRcd'),
        data = cms.vstring('EcalPedestals')
    ))
)
142

143
process.dump = cms.OutputModule("AsciiOutputModule")
144

145
146
process.p = cms.Path(process.get)
process.ep = cms.EndPath(process.dump)
147

ericw's avatar
ericw committed
148
EOI
149
150
printf "configuration script:\n"
cat ecal_pedestals.py
ericw's avatar
ericw committed
151
152
153
154
155
156
157
start=`date +%s`
#
# Run cmsRun
#
printf "Squid nogzip Access test for ECAL\n" 1>&2
printf "START TIME: `date` ACTION: Squid nogzip Access test for ECAL\n"
printf "`date` --> running cmsRun ...\n"
158
cmsRun -p ecal_pedestals.py > stdout.txt 2>stderr.txt
ericw's avatar
ericw committed
159
srun=$?
ericw's avatar
ericw committed
160
161
cat stdout.txt
cat stderr.txt
ericw's avatar
ericw committed
162
163
printf "`date` --> DONE\n"
stop=`date +%s`
164
165
166
167
#
# Check cmsRun exit status
#
if [ $srun -ne 0 ]
ericw's avatar
ericw committed
168
169
170
171
172
then
   printf "CMSSW_frontier.sh: Error $srun from cmsRun\n"
   exit $SAME_ERROR
fi
#
Dong Liang's avatar
Dong Liang committed
173
174
175
176
177
178
179
180
181
182
# Check Trying direct connect to server
#
grep -q "Trying direct connect to server" stdout.txt
tgrep=$?
if [ $tgrep -eq 0 ]
then
	printf "CMSSW_frontier.sh: Error. Trying direct connect to CERN server\n"
	exit $SAME_ERROR
fi
#
Dong Liang's avatar
Dong Liang committed
183
# Check Trying next proxy
Dong Liang's avatar
Dong Liang committed
184
#
Dong Liang's avatar
Dong Liang committed
185
grep -q "Trying next proxy" stdout.txt
Dong Liang's avatar
Dong Liang committed
186
187
188
189
190
191
192
193
194
195
196
ngrep=$?
if [ $ngrep -eq 0 ]
then 
	printf "CMSSW_frontier.sh: Warning. one squid proxy failed\n"
	exit $SAME_WARNING
fi
#
# Check ping Warning
#
if [ $ever_warning -eq 1 ]
then
Dong Liang's avatar
Dong Liang committed
197
	printf "CMSSW_frontier.sh: Warning from Ping, at least one proxy ping error\n"
Andrea Sciaba's avatar
Andrea Sciaba committed
198
	exit $SAME_OK
Dong Liang's avatar
Dong Liang committed
199
200
201
202
fi
if [ $ever_warning -eq 2 ]
then 
	printf "CMSSW_frontier.sh: Warning from Ping, all the proxies ping error\n"
Andrea Sciaba's avatar
Andrea Sciaba committed
203
	exit $SAME_OK
Dong Liang's avatar
Dong Liang committed
204
205
fi
#
ericw's avatar
ericw committed
206
207
# Exit
#
ericw's avatar
ericw committed
208
printf "ELAPSED TIME: $[ $stop - $start ] seconds\n"
209
printf "OK\n"
ericw's avatar
ericw committed
210
exit $SAME_OK