43 startDir = os.getcwd()
45 wfDir = self.wf.numId+
'_'+self.wf.nameId
46 if not os.path.exists(wfDir):
50 if os.path.exists( os.path.join(os.environ[
"CMS_PATH"],
'cmsset_default.sh') ) :
51 preamble =
'source $CMS_PATH/cmsset_default.sh; '
53 preamble =
'source $CMS_PATH/sw/cmsset_default.sh; '
54 preamble +=
'eval `scram run -sh`; '
55 preamble +=
'cd '+wfDir+
'; '
56 preamble +=
'ulimit -v 4069000;'
58 startime=
'date %s' %time.asctime()
65 if not self.wf.cmdStep2: stat2 =
'NOSTEP'
66 if not self.wf.cmdStep3: stat3 =
'NOSTEP'
67 if not self.wf.cmdStep4: stat4 =
'NOSTEP'
72 inFile =
'file:raw.root'
73 if 'REALDATA' in self.wf.cmdStep1:
74 realDataRe = re.compile(
'REALDATA:\s*(/[A-Za-z].*?),(\s*RUN:\s*(?P<run>\d+),)?(\s*FILES:\s*(?P<files>\d+),)?(\s*EVENTS:\s*(?P<events>\d+))?,\s*LABEL:\s*(?P<label>.*),\s*LOCATION:\s*(?P<location>.*)\s*')
75 realDataMatch = realDataRe.match(self.wf.cmdStep1)
78 if realDataMatch.group(
"run") : run = realDataMatch.group(
"run")
79 label = realDataMatch.group(
"label")
80 location = realDataMatch.group(
"location").lower().
strip()
82 print "ignoring workflow ",self.wf.numId, self.wf.nameId,
' as this is on CAF ...'
83 self.
npass = [0,0,0,0]
84 self.
nfail = [0,0,0,0]
86 logStat =
'Step1-NOTRUN Step2-NOTRUN Step3-NOTRUN Step4-NOTRUN '
87 self.
report+=
'%s_%s %s - time %s; exit: %s %s %s %s \n' % (self.wf.numId, self.wf.nameId, logStat, 0, 0,0,0,0)
92 if realDataMatch.group(
"files"):
93 files = realDataMatch.group(
"files")
94 if realDataMatch.group(
"events"):
95 events = realDataMatch.group(
"events")
96 if self.wf.cmdStep2
and ' -n ' not in self.wf.cmdStep2: self.wf.cmdStep2 +=
' -n ' + events
97 if self.wf.cmdStep3
and ' -n ' not in self.wf.cmdStep3: self.wf.cmdStep3 +=
' -n ' + events
98 if self.wf.cmdStep4
and ' -n ' not in self.wf.cmdStep4: self.wf.cmdStep4 +=
' -n ' + events
100 print "run, files, events, label", run, files, events, label
101 cmd +=
'dbs search --noheader --url=http://cmsdbsprod.cern.ch/cms_dbs_prod_global/servlet/DBSServlet '
102 cmd +=
"--query='find file where dataset like "+realDataMatch.group(1)
103 if run: cmd +=
" and run=" + run
105 cmd +=
' > %s 2>&1; ' % (
'step1_'+self.wf.nameId+
'-dbsquery.log',)
106 retStep1 = self.
doCmd(cmd)
108 lf = open(wfDir+
'/step1_'+self.wf.nameId+
'-dbsquery.log',
'r')
109 lines = lf.readlines()
111 if not lines
or len(lines)==0 :
112 inFile =
"NoFileFoundInDBS"
116 inFile = lines[0].
strip()
118 print "ERROR determining file from DBS query: ", str(e)
119 inFile =
"NoFileFoundInDBS"
122 print "ERROR: found REALDATA in '"+self.wf.cmdStep1+
"' but not RE match !!??!"
125 cmd += self.wf.cmdStep1 +
' --fileout file:raw.root '
126 cmd +=
' > %s 2>&1; ' % (
'step1_'+self.wf.nameId+
'.log ',)
127 retStep1 = self.
doCmd(cmd)
129 print " ... ret: " , retStep1
136 if self.wf.cmdStep2
and retStep1 == 0:
138 fullcmd += self.wf.cmdStep2
139 if ' -n ' not in fullcmd : fullcmd +=
' -n -1 '
140 fullcmd +=
' --fileout file:reco.root '
141 print '=====>>> ', self.wf.nameId, self.wf.numId
146 if (
'40.0' in str(self.wf.numId) ) :
147 fullcmd +=
' --himix '
148 inFile =
'/store/relval/CMSSW_3_9_7/RelValPyquen_ZeemumuJets_pt10_2760GeV/GEN-SIM-DIGI-RAW-HLTDEBUG/START39_V7HI-v1/0054/102FF831-9B0F-E011-A3E9-003048678BC6.root'
149 if (
'41.0' in str(self.wf.numId) ) :
150 fullcmd +=
' --himix '
151 inFile =
'/store/relval/CMSSW_3_9_7/RelValPyquen_GammaJet_pt20_2760GeV/GEN-SIM-DIGI-RAW-HLTDEBUG/START39_V7HI-v1/0054/06B4F699-A50F-E011-AD62-0018F3D0962E.root'
153 fullcmd +=
' --filein '+inFile+
' '
154 fullcmd +=
' > %s 2>&1; ' % (
'step2_'+self.wf.nameId+
'.log ',)
156 retStep2 = self.
doCmd(fullcmd)
159 if self.wf.cmdStep3
and retStep2 == 0:
161 fullcmd += self.wf.cmdStep3
162 if ' -n ' not in fullcmd : fullcmd +=
' -n -1 '
164 if not '134' in str(self.wf.numId):
165 if 'HARVESTING' in fullcmd
and not 'filein' in fullcmd:
166 fullcmd +=
' --filein file:reco_inDQM.root --fileout file:step3.root '
168 fullcmd +=
' --filein file:reco.root --fileout file:step3.root '
169 fullcmd +=
' > %s 2>&1; ' % (
'step3_'+self.wf.nameId+
'.log ',)
171 retStep3 = self.
doCmd(fullcmd)
173 if self.wf.cmdStep4
and retStep3 == 0:
175 fullcmd += self.wf.cmdStep4
176 if ' -n ' not in fullcmd : fullcmd +=
' -n -1 '
178 if not '134' in str(self.wf.numId):
179 fullcmd +=
' --filein file:step3.root '
180 fullcmd +=
' > %s 2>&1; ' % (
'step4_'+self.wf.nameId+
'.log ',)
182 retStep4 = self.
doCmd(fullcmd)
187 endtime=
'date %s' %time.asctime()
188 tottime=
'%s-%s'%(endtime,startime)
190 self.
nfail = [0,0,0,0]
191 self.
npass = [1,1,1,1]
192 if 'NOSTEP' in stat2:
193 self.
npass = [1,0,0,0]
195 if 'NOSTEP' in stat3 :
196 self.
npass = [1,1,0,0]
197 if 'NOSTEP' in stat4 :
198 self.
npass = [1,1,1,0]
204 self.
npass = [0,0,0,0]
205 self.
nfail = [1,0,0,0]
211 self.
npass = [1,0,0,0]
212 self.
nfail = [0,1,0,0]
217 self.
npass = [1,1,0,0]
218 self.
nfail = [0,0,1,0]
222 self.
npass = [1,1,1,0]
223 self.
nfail = [0,0,0,1]
225 logStat =
'Step1-'+stat1+
' Step2-'+stat2+
' Step3-'+stat3+
' '+
' Step4-'+stat4+
' '
226 self.
report+=
'%s_%s %s - time %s; exit: %s %s %s %s \n' % (self.wf.numId, self.wf.nameId, logStat, tottime, retStep1,retStep2,retStep3, retStep4)