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'))
57 self.
wmagent=os.getenv(
'WMAGENT_REQMGR')
63 self.
wmagent =
'cmsweb-testbed.cern.ch'
64 self.
DbsUrl =
"https://"+self.
wmagent+
"/dbs/int/global/DBSReader"
67 self.
dqmgui=
"https://cmsweb.cern.ch/dqm/relval"
72 self.
user = os.getenv(
'USER')
80 if not os.getenv(
'WMCORE_ROOT'):
81 print '\n\twmclient is not setup properly. Will not be able to upload or submit requests.\n'
86 print '\n\tFound wmclient\n'
89 "RequestType" :
"TaskChain",
90 "SubRequestType" :
"RelVal",
91 "RequestPriority": 500000,
92 "Requestor": self.
user,
94 "CMSSWVersion": os.getenv(
'CMSSW_VERSION'),
95 "Campaign": os.getenv(
'CMSSW_VERSION'),
96 "ScramArch": os.getenv(
'SCRAM_ARCH'),
97 "ProcessingVersion": self.
version,
99 "CouchURL": self.
couch,
100 "ConfigCacheURL": self.
couch,
106 "unmergedLFNBase" :
"/store/unmerged",
107 "mergedLFNBase" :
"/store/relval",
108 "dashboardActivity" :
"relval",
111 "SizePerEvent" : 1234,
116 "EnableHarvesting" :
"True",
117 "DQMUploadUrl" : self.
dqmgui,
118 "DQMConfigCacheID" :
None,
124 "ConfigCacheID" :
None,
126 "SplittingAlgo" :
"EventBased",
127 "EventsPerJob" :
None,
128 "RequestNumEvents" :
None,
129 "Seeding" :
"AutomaticSeeding",
130 "PrimaryDataset" :
None,
132 "Multicore" : opt.nThreads,
136 "TaskName" :
"DigiHLT",
137 "ConfigCacheID" :
None,
139 "InputDataset" :
None,
140 "SplittingAlgo" :
"LumiBased",
143 "Multicore" : opt.nThreads,
149 "InputFromOutputModule" :
None,
150 "ConfigCacheID" :
None,
152 "SplittingAlgo" :
"LumiBased",
155 "Multicore" : opt.nThreads,
162 def prepare(self,mReader, directories, mode='init'):
169 wmsplit[
'RECODreHLT']=2
173 wmsplit[
'DIGIUP15_PU50']=1
174 wmsplit[
'RECOUP15_PU50']=1
175 wmsplit[
'DIGIUP15_PU25']=1
176 wmsplit[
'RECOUP15_PU25']=1
177 wmsplit[
'DIGIUP15_PU25HS']=1
178 wmsplit[
'RECOUP15_PU25HS']=1
179 wmsplit[
'DIGIHIMIX']=5
180 wmsplit[
'RECOHIMIX']=5
181 wmsplit[
'RECODSplit']=1
182 wmsplit[
'SingleMuPt10_UP15_ID']=1
183 wmsplit[
'DIGIUP15_ID']=1
184 wmsplit[
'RECOUP15_ID']=1
185 wmsplit[
'TTbar_13_ID']=1
186 wmsplit[
'SingleMuPt10FS_ID']=1
187 wmsplit[
'TTbarFS_ID']=1
188 wmsplit[
'RECODR2_50nsreHLT']=5
189 wmsplit[
'RECODR2_25nsreHLT']=5
190 wmsplit[
'RECODR2_2016reHLT']=5
191 wmsplit[
'RECODR2_50nsreHLT_HIPM']=5
192 wmsplit[
'RECODR2_25nsreHLT_HIPM']=5
193 wmsplit[
'RECODR2_2016reHLT_HIPM']=5
194 wmsplit[
'RECODR2_2016reHLT_skimSingleMu']=5
195 wmsplit[
'RECODR2_2016reHLT_skimDoubleEG']=5
196 wmsplit[
'RECODR2_2016reHLT_skimMuonEG']=5
197 wmsplit[
'RECODR2_2016reHLT_skimJetHT']=5
198 wmsplit[
'RECODR2_2016reHLT_skimMET']=5
199 wmsplit[
'RECODR2_2016reHLT_skimSinglePh']=5
200 wmsplit[
'RECODR2_2016reHLT_skimMuOnia']=5
201 wmsplit[
'RECODR2_2016reHLT_skimSingleMu_HIPM']=5
202 wmsplit[
'RECODR2_2016reHLT_skimDoubleEG_HIPM']=5
203 wmsplit[
'RECODR2_2016reHLT_skimMuonEG_HIPM']=5
204 wmsplit[
'RECODR2_2016reHLT_skimJetHT_HIPM']=5
205 wmsplit[
'RECODR2_2016reHLT_skimMET_HIPM']=5
206 wmsplit[
'RECODR2_2016reHLT_skimSinglePh_HIPM']=5
207 wmsplit[
'RECODR2_2016reHLT_skimMuOnia_HIPM']=5
208 wmsplit[
'HLTDR2_50ns']=1
209 wmsplit[
'HLTDR2_25ns']=1
210 wmsplit[
'HLTDR2_2016']=1
211 wmsplit[
'Hadronizer']=1
212 wmsplit[
'DIGIUP15']=1
213 wmsplit[
'RECOUP15']=1
214 wmsplit[
'RECOAODUP15']=5
215 wmsplit[
'DBLMINIAODMCUP15NODQM']=5
216 wmsplit[
'DigiFull']=5
217 wmsplit[
'RecoFull']=5
218 wmsplit[
'DigiFullPU']=1
219 wmsplit[
'RecoFullPU']=1
225 print "Not set up for step splitting"
229 for (n,dir)
in directories.items():
231 print "inspecting",dir
233 for (x,s)
in mReader.workFlowSteps.items():
243 if len( [step
for step
in s[3]
if "HARVESTGEN" in step] )>0:
244 chainDict[
'TimePerEvent']=0.01
245 thisLabel=thisLabel+
"_gen"
247 if len( [step
for step
in s[3]
if "DBLMINIAODMCUP15NODQM" in step] )>0:
248 thisLabel=thisLabel+
"_dblMiniAOD"
253 if 'INPUT' in step
or (
not isinstance(s[2][index],str)):
254 nextHasDSInput=s[2][index]
262 chainDict[
'nowmTasklist'][-1][
'nowmIO']=json.loads(open(
'%s/%s.io'%(dir,step)).
read())
264 print "Failed to find",
'%s/%s.io'%(dir,step),
".The workflows were probably not run on cfg not created"
267 chainDict[
'nowmTasklist'][-1][
'PrimaryDataset']=
'RelVal'+s[1].
split(
'+')[0]
268 if not '--relval' in s[2][index]:
269 print 'Impossible to create task from scratch without splitting information with --relval'
272 arg=s[2][index].
split()
273 ns=map(int,arg[arg.index(
'--relval')+1].
split(
','))
274 chainDict[
'nowmTasklist'][-1][
'RequestNumEvents'] = ns[0]
275 chainDict[
'nowmTasklist'][-1][
'EventsPerJob'] = ns[1]
276 if 'FASTSIM' in s[2][index]
or '--fast' in s[2][index]:
277 thisLabel+=
'_FastSim'
278 if 'lhe' in s[2][index]
in s[2][index]:
279 chainDict[
'nowmTasklist'][-1][
'LheInputFiles'] =
True
284 chainDict[
'nowmTasklist'][-1][
'nowmIO']=json.loads(open(
'%s/%s.io'%(dir,step)).
read())
286 print "Failed to find",
'%s/%s.io'%(dir,step),
".The workflows were probably not run on cfg not created"
288 chainDict[
'nowmTasklist'][-1][
'InputDataset']=nextHasDSInput.dataSet
289 splitForThisWf=nextHasDSInput.split
290 chainDict[
'nowmTasklist'][-1][
'LumisPerJob']=splitForThisWf
292 chainDict[
'nowmTasklist'][-1][
'LumisPerJob']=wmsplit[step]
294 if len(nextHasDSInput.run):
295 chainDict[
'nowmTasklist'][-1][
'RunWhitelist']=nextHasDSInput.run
296 if len(nextHasDSInput.ls):
297 chainDict[
'nowmTasklist'][-1][
'LumiList']=nextHasDSInput.ls
299 if '--data' in s[2][index]
and nextHasDSInput.label:
300 thisLabel+=
'_RelVal_%s'%nextHasDSInput.label
301 if 'filter' in chainDict[
'nowmTasklist'][-1][
'nowmIO']:
302 print "This has an input DS and a filter sequence: very likely to be the PyQuen sample"
303 processStrPrefix=
'PU_'
304 setPrimaryDs =
'RelVal'+s[1].
split(
'+')[0]
306 chainDict[
'nowmTasklist'][-1][
'PrimaryDataset']=setPrimaryDs
312 chainDict[
'nowmTasklist'][-1][
'nowmIO']=json.loads(open(
'%s/%s.io'%(dir,step)).
read())
314 print "Failed to find",
'%s/%s.io'%(dir,step),
".The workflows were probably not run on cfg not created"
317 chainDict[
'nowmTasklist'][-1][
'LumisPerJob']=splitForThisWf
319 chainDict[
'nowmTasklist'][-1][
'LumisPerJob']=wmsplit[step]
322 if 'Hadronizer' in step:
323 chainDict[
'nowmTasklist'][-1][
'LumisPerJob']=wmsplit[
'Hadronizer']
326 chainDict[
'nowmTasklist'][-1][
'TaskName']=step
328 chainDict[
'nowmTasklist'][-1][
'PrimaryDataset']=setPrimaryDs
329 chainDict[
'nowmTasklist'][-1][
'ConfigCacheID']=
'%s/%s.py'%(dir,step)
330 chainDict[
'nowmTasklist'][-1][
'GlobalTag']=chainDict[
'nowmTasklist'][-1][
'nowmIO'][
'GT']
331 chainDict[
'GlobalTag']=chainDict[
'nowmTasklist'][-1][
'nowmIO'][
'GT']
332 if 'pileup' in chainDict[
'nowmTasklist'][-1][
'nowmIO']:
333 chainDict[
'nowmTasklist'][-1][
'MCPileup']=chainDict[
'nowmTasklist'][-1][
'nowmIO'][
'pileup']
334 if '--pileup ' in s[2][index]:
335 processStrPrefix=
'PU_'
337 processStrPrefix=
'PU25ns_'
339 processStrPrefix=
'PU50ns_'
340 if 'DIGIPREMIX_S2' in s[2][index] :
342 processStrPrefix=
'PUpmx25ns_'
343 elif s[2][index].
split()[ s[2][index].
split().
index(
'--pileup_input')+1 ].
find(
'50ns') > 0 :
344 processStrPrefix=
'PUpmx50ns_'
348 chainDict[
'AcquisitionEra'][step]=chainDict[
'CMSSWVersion']
349 chainDict[
'ProcessingString'][step]=processStrPrefix+chainDict[
'nowmTasklist'][-1][
'GlobalTag'].
replace(
'::All',
'')+thisLabel
352 chainDict[
'nowmTasklist'][-1][
'AcquisitionEra']=chainDict[
'CMSSWVersion']
353 chainDict[
'nowmTasklist'][-1][
'ProcessingString']=processStrPrefix+chainDict[
'nowmTasklist'][-1][
'GlobalTag'].
replace(
'::All',
'')+thisLabel
356 if (
'DBLMINIAODMCUP15NODQM' in step):
357 chainDict[
'nowmTasklist'][-1][
'ProcessingString']=chainDict[
'nowmTasklist'][-1][
'ProcessingString']+
'_miniAOD'
359 if( chainDict[
'nowmTasklist'][-1][
'Multicore'] ):
366 chainDict[
'nowmTasklist'][-1][
'Memory'] = self.
memoryOffset + int( chainDict[
'nowmTasklist'][-1][
'Multicore'] -1 ) * self.
memPerCore
370 chainDict[
'RequestString']=
'RV'+chainDict[
'CMSSWVersion']+s[1].
split(
'+')[0]
371 if processStrPrefix
or thisLabel:
372 chainDict[
'RequestString']+=
'_'+processStrPrefix+thisLabel
381 for i_second
in reversed(range(len(chainDict[
'nowmTasklist']))):
382 t_second=chainDict[
'nowmTasklist'][i_second]
384 if 'primary' in t_second[
'nowmIO']:
386 primary=t_second[
'nowmIO'][
'primary'][0].
replace(
'file:',
'')
387 for i_input
in reversed(range(0,i_second)):
388 t_input=chainDict[
'nowmTasklist'][i_input]
389 for (om,o)
in t_input[
'nowmIO'].
items():
392 t_second[
'InputTask'] = t_input[
'TaskName']
393 t_second[
'InputFromOutputModule'] = om
395 if t_second[
'TaskName'].startswith(
'HARVEST'):
397 chainDict[
'DQMConfigCacheID']=t_second[
'ConfigCacheID']
417 chainDict[
'AcquisitionEra'] = chainDict[
'AcquisitionEra'].
values()[0]
418 chainDict[
'ProcessingString'] = chainDict[
'ProcessingString'].
values()[0]
420 chainDict[
'AcquisitionEra'] = chainDict[
'nowmTasklist'][0][
'AcquisitionEra']
421 chainDict[
'ProcessingString'] = chainDict[
'nowmTasklist'][0][
'ProcessingString']
423 chainDict[
'Campaign'] = chainDict[
'AcquisitionEra']
429 if type(i)==int
and i < len(chainDict[
'nowmTasklist']):
430 chainDict[
'nowmTasklist'][i][
'KeepOutput']=
True
431 for (i,t)
in enumerate(chainDict[
'nowmTasklist']):
432 if t[
'TaskName'].startswith(
'HARVEST'):
436 elif t[
'TaskName']
in self.
keep:
440 chainDict[
'Task%d'%(itask)]=t
447 chainDict[
'TaskChain']=itask
449 chainDict.pop(
'nowmTasklist')
456 labelInCouch=self.
label+
'_'+label
457 cacheName=filePath.split(
'/')[-1]
460 print '\tFake upload of',filePath,
'to couch with label',labelInCouch
464 from modules.wma
import upload_to_couch,DATABASE_NAME
466 print '\n\tUnable to find wmcontrol modules. Please include it in your python path\n'
471 print "Not re-uploading",filePath,
"to",where,
"for",label
474 print "Loading",filePath,
"to",where,
"for",label
476 pool = multiprocessing.Pool(1)
477 cacheIds = pool.map( upload_to_couch_oneArg, [(filePath,labelInCouch,self.
user,self.
group,where)] )
478 cacheId = cacheIds[0]
483 for (n,d)
in self.chainDicts.items():
485 if it.startswith(
"Task")
and it!=
'TaskChain':
487 couchID=self.
uploadConf(d[it][
'ConfigCacheID'],
488 str(n)+d[it][
'TaskName'],
491 print d[it][
'ConfigCacheID'],
" uploaded to couchDB for",str(n),
"with ID",couchID
492 d[it][
'ConfigCacheID']=couchID
493 if it ==
'DQMConfigCacheID':
494 couchID=self.
uploadConf(d[
'DQMConfigCacheID'],
498 print d[
'DQMConfigCacheID'],
"uploaded to couchDB for",str(n),
"with ID",couchID
499 d[
'DQMConfigCacheID']=couchID
504 from modules.wma
import makeRequest,approveRequest
505 from wmcontrol
import random_sleep
506 print '\n\tFound wmcontrol\n'
508 print '\n\tUnable to find wmcontrol modules. Please include it in your python path\n'
514 for (n,d)
in self.chainDicts.items():
516 print "Only viewing request",n
517 print pprint.pprint(d)
520 print "For eyes before submitting",n
521 print pprint.pprint(d)
522 print "Submitting",n,
"..........."
523 workFlow=makeRequest(self.
wmagent,d,encodeDict=
True)
524 approveRequest(self.
wmagent,workFlow)
525 print "...........",n,
"submitted"
boost::dynamic_bitset append(const boost::dynamic_bitset<> &bs1, const boost::dynamic_bitset<> &bs2)
this method takes two bitsets bs1 and bs2 and returns result of bs2 appended to the end of bs1 ...
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
def performInjectionOptionTest
def upload_to_couch_oneArg