9 print 'Not injecting to wmagent in --show mode. Need to run the worklfows.'
11 if opt.wmcontrol==
'init':
14 if opt.wmcontrol==
'test':
17 if opt.wmcontrol==
'submit' and opt.nProcs==0:
18 print 'Not injecting to wmagent in -j 0 mode. Need to run the worklfows.'
20 if opt.wmcontrol==
'force':
21 print "This is an expert setting, you'd better know what you're doing"
25 from modules.wma
import upload_to_couch
26 (filePath,labelInCouch,user,group,where) = arguments
27 cacheId=upload_to_couch(filePath,
43 for k
in options.split(
','):
44 if k.startswith(
'dqm:'):
45 self.
dqmgui=k.split(
':',1)[-1]
46 elif k.startswith(
'wma:'):
49 self.
testMode=((mode!=
'submit')
and (mode!=
'force'))
55 self.
wmagent=os.getenv(
'WMAGENT_REQMGR')
61 self.
wmagent =
'cmsweb-testbed.cern.ch'
62 self.
DbsUrl =
"https://"+self.
wmagent+
"/dbs/int/global/DBSReader"
65 self.
dqmgui=
"https://cmsweb.cern.ch/dqm/relval"
70 self.
user = os.getenv(
'USER')
78 if not os.getenv(
'WMCORE_ROOT'):
79 print '\n\twmclient is not setup properly. Will not be able to upload or submit requests.\n'
84 print '\n\tFound wmclient\n'
87 "RequestType" :
"TaskChain",
88 "SubRequestType" :
"RelVal",
89 "RequestPriority": 500000,
90 "Requestor": self.
user,
92 "CMSSWVersion": os.getenv(
'CMSSW_VERSION'),
93 "Campaign": os.getenv(
'CMSSW_VERSION'),
94 "ScramArch": os.getenv(
'SCRAM_ARCH'),
95 "ProcessingVersion": self.
version,
97 "CouchURL": self.
couch,
98 "ConfigCacheURL": self.
couch,
104 "unmergedLFNBase" :
"/store/unmerged",
105 "mergedLFNBase" :
"/store/relval",
106 "dashboardActivity" :
"relval",
107 "Multicore" : opt.nThreads,
109 "SizePerEvent" : 1234,
114 "EnableHarvesting" :
"True",
115 "DQMUploadUrl" : self.
dqmgui,
116 "DQMConfigCacheID" :
None
121 "ConfigCacheID" :
None,
123 "SplittingAlgo" :
"EventBased",
124 "EventsPerJob" :
None,
125 "RequestNumEvents" :
None,
126 "Seeding" :
"AutomaticSeeding",
127 "PrimaryDataset" :
None,
132 "TaskName" :
"DigiHLT",
133 "ConfigCacheID" :
None,
135 "InputDataset" :
None,
136 "SplittingAlgo" :
"LumiBased",
144 "InputFromOutputModule" :
None,
145 "ConfigCacheID" :
None,
147 "SplittingAlgo" :
"LumiBased",
156 def prepare(self,mReader, directories, mode='init'):
163 wmsplit[
'RECODreHLT']=2
167 wmsplit[
'DIGIUP15_PU50']=1
168 wmsplit[
'RECOUP15_PU50']=1
169 wmsplit[
'DIGIUP15_PU25']=1
170 wmsplit[
'RECOUP15_PU25']=1
171 wmsplit[
'DIGIHIMIX']=5
172 wmsplit[
'RECOHIMIX']=5
173 wmsplit[
'RECODSplit']=1
174 wmsplit[
'SingleMuPt10_UP15_ID']=1
175 wmsplit[
'DIGIUP15_ID']=1
176 wmsplit[
'RECOUP15_ID']=1
177 wmsplit[
'TTbar_13_ID']=1
178 wmsplit[
'SingleMuPt10FS_ID']=1
179 wmsplit[
'TTbarFS_ID']=1
180 wmsplit[
'RECODR2_50nsreHLT']=1
181 wmsplit[
'RECODR2_25nsreHLT']=1
182 wmsplit[
'HLTDR2_50ns']=1
183 wmsplit[
'HLTDR2_25ns']=1
184 wmsplit[
'Hadronizer']=1
185 wmsplit[
'REMINIAODPROD']=1
186 wmsplit[
'REMINIAOD']=1
187 wmsplit[
'REMINIAOD_PU50']=1
188 wmsplit[
'REMINIAOD_PU25']=1
189 wmsplit[
'REMINIAODDR2_50ns']=1
190 wmsplit[
'REMINIAODDR2_25ns']=1
195 print "Not set up for step splitting"
199 for (n,dir)
in directories.items():
201 print "inspecting",dir
203 for (x,s)
in mReader.workFlowSteps.items():
213 if len( [step
for step
in s[3]
if "HARVESTGEN" in step] )>0:
214 chainDict[
'TimePerEvent']=0.01
215 thisLabel=thisLabel+
"_gen"
217 if len( [step
for step
in s[3]
if "REMINIAOD" in step] )>0:
218 thisLabel=thisLabel+
"_ReMiniAOD"
223 if 'INPUT' in step
or (
not isinstance(s[2][index],str)):
224 nextHasDSInput=s[2][index]
232 chainDict[
'nowmTasklist'][-1][
'nowmIO']=json.loads(open(
'%s/%s.io'%(dir,step)).
read())
234 print "Failed to find",
'%s/%s.io'%(dir,step),
".The workflows were probably not run on cfg not created"
237 chainDict[
'nowmTasklist'][-1][
'PrimaryDataset']=
'RelVal'+s[1].
split(
'+')[0]
238 if not '--relval' in s[2][index]:
239 print 'Impossible to create task from scratch without splitting information with --relval'
242 arg=s[2][index].
split()
243 ns=
map(int,arg[arg.index(
'--relval')+1].
split(
','))
244 chainDict[
'nowmTasklist'][-1][
'RequestNumEvents'] = ns[0]
245 chainDict[
'nowmTasklist'][-1][
'EventsPerJob'] = ns[1]
246 if 'FASTSIM' in s[2][index]
or '--fast' in s[2][index]:
247 thisLabel+=
'_FastSim'
248 if 'lhe' in s[2][index]
in s[2][index]:
249 chainDict[
'nowmTasklist'][-1][
'LheInputFiles'] =
True
254 chainDict[
'nowmTasklist'][-1][
'nowmIO']=json.loads(open(
'%s/%s.io'%(dir,step)).
read())
256 print "Failed to find",
'%s/%s.io'%(dir,step),
".The workflows were probably not run on cfg not created"
258 chainDict[
'nowmTasklist'][-1][
'InputDataset']=nextHasDSInput.dataSet
259 splitForThisWf=nextHasDSInput.split
260 chainDict[
'nowmTasklist'][-1][
'LumisPerJob']=splitForThisWf
262 chainDict[
'nowmTasklist'][-1][
'LumisPerJob']=wmsplit[step]
264 if len(nextHasDSInput.run):
265 chainDict[
'nowmTasklist'][-1][
'RunWhitelist']=nextHasDSInput.run
266 if len(nextHasDSInput.ls):
267 chainDict[
'nowmTasklist'][-1][
'LumiList']=nextHasDSInput.ls
269 if '--data' in s[2][index]
and nextHasDSInput.label:
270 thisLabel+=
'_RelVal_%s'%nextHasDSInput.label
271 if 'filter' in chainDict[
'nowmTasklist'][-1][
'nowmIO']:
272 print "This has an input DS and a filter sequence: very likely to be the PyQuen sample"
273 processStrPrefix=
'PU_'
274 setPrimaryDs =
'RelVal'+s[1].
split(
'+')[0]
276 chainDict[
'nowmTasklist'][-1][
'PrimaryDataset']=setPrimaryDs
282 chainDict[
'nowmTasklist'][-1][
'nowmIO']=json.loads(open(
'%s/%s.io'%(dir,step)).
read())
284 print "Failed to find",
'%s/%s.io'%(dir,step),
".The workflows were probably not run on cfg not created"
287 chainDict[
'nowmTasklist'][-1][
'LumisPerJob']=splitForThisWf
289 chainDict[
'nowmTasklist'][-1][
'LumisPerJob']=wmsplit[step]
292 if 'Hadronizer' in step:
293 chainDict[
'nowmTasklist'][-1][
'LumisPerJob']=wmsplit[
'Hadronizer']
296 chainDict[
'nowmTasklist'][-1][
'TaskName']=step
298 chainDict[
'nowmTasklist'][-1][
'PrimaryDataset']=setPrimaryDs
299 chainDict[
'nowmTasklist'][-1][
'ConfigCacheID']=
'%s/%s.py'%(dir,step)
300 chainDict[
'nowmTasklist'][-1][
'GlobalTag']=chainDict[
'nowmTasklist'][-1][
'nowmIO'][
'GT']
301 chainDict[
'GlobalTag']=chainDict[
'nowmTasklist'][-1][
'nowmIO'][
'GT']
302 if 'pileup' in chainDict[
'nowmTasklist'][-1][
'nowmIO']:
303 chainDict[
'nowmTasklist'][-1][
'MCPileup']=chainDict[
'nowmTasklist'][-1][
'nowmIO'][
'pileup']
304 if '--pileup ' in s[2][index]:
305 processStrPrefix=
'PU_'
307 processStrPrefix=
'PU25ns_'
309 processStrPrefix=
'PU50ns_'
310 if 'DIGIPREMIX_S2' in s[2][index] :
312 processStrPrefix=
'PUpmx25ns_'
313 elif s[2][index].
split()[ s[2][index].
split().
index(
'--pileup_input')+1 ].
find(
'50ns') > 0 :
314 processStrPrefix=
'PUpmx50ns_'
318 chainDict[
'AcquisitionEra'][step]=chainDict[
'CMSSWVersion']
319 chainDict[
'ProcessingString'][step]=processStrPrefix+chainDict[
'nowmTasklist'][-1][
'GlobalTag'].
replace(
'::All',
'')+thisLabel
322 chainDict[
'nowmTasklist'][-1][
'AcquisitionEra']=chainDict[
'CMSSWVersion']
323 chainDict[
'nowmTasklist'][-1][
'ProcessingString']=processStrPrefix+chainDict[
'nowmTasklist'][-1][
'GlobalTag'].
replace(
'::All',
'')+thisLabel
327 chainDict[
'RequestString']=
'RV'+chainDict[
'CMSSWVersion']+s[1].
split(
'+')[0]
328 if processStrPrefix
or thisLabel:
329 chainDict[
'RequestString']+=
'_'+processStrPrefix+thisLabel
338 for i_second
in reversed(range(len(chainDict[
'nowmTasklist']))):
339 t_second=chainDict[
'nowmTasklist'][i_second]
341 if 'primary' in t_second[
'nowmIO']:
343 primary=t_second[
'nowmIO'][
'primary'][0].
replace(
'file:',
'')
344 for i_input
in reversed(range(0,i_second)):
345 t_input=chainDict[
'nowmTasklist'][i_input]
346 for (om,o)
in t_input[
'nowmIO'].items():
349 t_second[
'InputTask'] = t_input[
'TaskName']
350 t_second[
'InputFromOutputModule'] = om
352 if t_second[
'TaskName'].startswith(
'HARVEST'):
354 chainDict[
'DQMConfigCacheID']=t_second[
'ConfigCacheID']
364 chainDict[
'AcquisitionEra'] = chainDict[
'AcquisitionEra'].
values()[0]
370 if type(i)==int
and i < len(chainDict[
'nowmTasklist']):
371 chainDict[
'nowmTasklist'][i][
'KeepOutput']=
True
372 for (i,t)
in enumerate(chainDict[
'nowmTasklist']):
373 if t[
'TaskName'].startswith(
'HARVEST'):
377 elif t[
'TaskName']
in self.
keep:
381 chainDict[
'Task%d'%(itask)]=t
388 chainDict[
'TaskChain']=itask
390 chainDict.pop(
'nowmTasklist')
397 labelInCouch=self.
label+
'_'+label
398 cacheName=filePath.split(
'/')[-1]
401 print '\tFake upload of',filePath,
'to couch with label',labelInCouch
405 from modules.wma
import upload_to_couch,DATABASE_NAME
407 print '\n\tUnable to find wmcontrol modules. Please include it in your python path\n'
412 print "Not re-uploading",filePath,
"to",where,
"for",label
415 print "Loading",filePath,
"to",where,
"for",label
417 pool = multiprocessing.Pool(1)
418 cacheIds = pool.map( upload_to_couch_oneArg, [(filePath,labelInCouch,self.
user,self.
group,where)] )
419 cacheId = cacheIds[0]
424 for (n,d)
in self.chainDicts.items():
426 if it.startswith(
"Task")
and it!=
'TaskChain':
428 couchID=self.
uploadConf(d[it][
'ConfigCacheID'],
429 str(n)+d[it][
'TaskName'],
432 print d[it][
'ConfigCacheID'],
" uploaded to couchDB for",str(n),
"with ID",couchID
433 d[it][
'ConfigCacheID']=couchID
434 if it ==
'DQMConfigCacheID':
435 couchID=self.
uploadConf(d[
'DQMConfigCacheID'],
439 print d[
'DQMConfigCacheID'],
"uploaded to couchDB for",str(n),
"with ID",couchID
440 d[
'DQMConfigCacheID']=couchID
445 from modules.wma
import makeRequest,approveRequest
446 from wmcontrol
import random_sleep
447 print '\n\tFound wmcontrol\n'
449 print '\n\tUnable to find wmcontrol modules. Please include it in your python path\n'
455 for (n,d)
in self.chainDicts.items():
457 print "Only viewing request",n
458 print pprint.pprint(d)
461 print "For eyes before submitting",n
462 print pprint.pprint(d)
463 print "Submitting",n,
"..........."
464 workFlow=makeRequest(self.
wmagent,d,encodeDict=
True)
465 approveRequest(self.
wmagent,workFlow)
466 print "...........",n,
"submitted"
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
def performInjectionOptionTest
def upload_to_couch_oneArg