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",
109 "SizePerEvent" : 1234,
114 "EnableHarvesting" :
"True",
115 "DQMUploadUrl" : self.
dqmgui,
116 "DQMConfigCacheID" :
None,
122 "ConfigCacheID" :
None,
124 "SplittingAlgo" :
"EventBased",
125 "EventsPerJob" :
None,
126 "RequestNumEvents" :
None,
127 "Seeding" :
"AutomaticSeeding",
128 "PrimaryDataset" :
None,
130 "Multicore" : opt.nThreads,
134 "TaskName" :
"DigiHLT",
135 "ConfigCacheID" :
None,
137 "InputDataset" :
None,
138 "SplittingAlgo" :
"LumiBased",
141 "Multicore" : opt.nThreads,
147 "InputFromOutputModule" :
None,
148 "ConfigCacheID" :
None,
150 "SplittingAlgo" :
"LumiBased",
153 "Multicore" : opt.nThreads,
160 def prepare(self,mReader, directories, mode='init'):
167 wmsplit[
'RECODreHLT']=2
171 wmsplit[
'DIGIUP15_PU50']=1
172 wmsplit[
'RECOUP15_PU50']=1
173 wmsplit[
'DIGIUP15_PU25']=1
174 wmsplit[
'RECOUP15_PU25']=1
175 wmsplit[
'DIGIUP15_PU25HS']=1
176 wmsplit[
'RECOUP15_PU25HS']=1
177 wmsplit[
'DIGIHIMIX']=5
178 wmsplit[
'RECOHIMIX']=5
179 wmsplit[
'RECODSplit']=1
180 wmsplit[
'SingleMuPt10_UP15_ID']=1
181 wmsplit[
'DIGIUP15_ID']=1
182 wmsplit[
'RECOUP15_ID']=1
183 wmsplit[
'TTbar_13_ID']=1
184 wmsplit[
'SingleMuPt10FS_ID']=1
185 wmsplit[
'TTbarFS_ID']=1
186 wmsplit[
'RECODR2_50nsreHLT']=1
187 wmsplit[
'RECODR2_25nsreHLT']=1
188 wmsplit[
'HLTDR2_50ns']=1
189 wmsplit[
'HLTDR2_25ns']=1
190 wmsplit[
'Hadronizer']=1
191 wmsplit[
'DIGIUP15']=5
192 wmsplit[
'RECOUP15']=5
193 wmsplit[
'RECOAODUP15']=5
194 wmsplit[
'DBLMINIAODMCUP15NODQM']=5
200 print "Not set up for step splitting"
204 for (n,dir)
in directories.items():
206 print "inspecting",dir
208 for (x,s)
in mReader.workFlowSteps.items():
218 if len( [step
for step
in s[3]
if "HARVESTGEN" in step] )>0:
219 chainDict[
'TimePerEvent']=0.01
220 thisLabel=thisLabel+
"_gen"
222 if len( [step
for step
in s[3]
if "DBLMINIAODMCUP15NODQM" in step] )>0:
223 thisLabel=thisLabel+
"_dblMiniAOD"
228 if 'INPUT' in step
or (
not isinstance(s[2][index],str)):
229 nextHasDSInput=s[2][index]
237 chainDict[
'nowmTasklist'][-1][
'nowmIO']=json.loads(open(
'%s/%s.io'%(dir,step)).
read())
239 print "Failed to find",
'%s/%s.io'%(dir,step),
".The workflows were probably not run on cfg not created"
242 chainDict[
'nowmTasklist'][-1][
'PrimaryDataset']=
'RelVal'+s[1].
split(
'+')[0]
243 if not '--relval' in s[2][index]:
244 print 'Impossible to create task from scratch without splitting information with --relval'
247 arg=s[2][index].
split()
248 ns=map(int,arg[arg.index(
'--relval')+1].
split(
','))
249 chainDict[
'nowmTasklist'][-1][
'RequestNumEvents'] = ns[0]
250 chainDict[
'nowmTasklist'][-1][
'EventsPerJob'] = ns[1]
251 if 'FASTSIM' in s[2][index]
or '--fast' in s[2][index]:
252 thisLabel+=
'_FastSim'
253 if 'lhe' in s[2][index]
in s[2][index]:
254 chainDict[
'nowmTasklist'][-1][
'LheInputFiles'] =
True
259 chainDict[
'nowmTasklist'][-1][
'nowmIO']=json.loads(open(
'%s/%s.io'%(dir,step)).
read())
261 print "Failed to find",
'%s/%s.io'%(dir,step),
".The workflows were probably not run on cfg not created"
263 chainDict[
'nowmTasklist'][-1][
'InputDataset']=nextHasDSInput.dataSet
264 splitForThisWf=nextHasDSInput.split
265 chainDict[
'nowmTasklist'][-1][
'LumisPerJob']=splitForThisWf
267 chainDict[
'nowmTasklist'][-1][
'LumisPerJob']=wmsplit[step]
269 if len(nextHasDSInput.run):
270 chainDict[
'nowmTasklist'][-1][
'RunWhitelist']=nextHasDSInput.run
271 if len(nextHasDSInput.ls):
272 chainDict[
'nowmTasklist'][-1][
'LumiList']=nextHasDSInput.ls
274 if '--data' in s[2][index]
and nextHasDSInput.label:
275 thisLabel+=
'_RelVal_%s'%nextHasDSInput.label
276 if 'filter' in chainDict[
'nowmTasklist'][-1][
'nowmIO']:
277 print "This has an input DS and a filter sequence: very likely to be the PyQuen sample"
278 processStrPrefix=
'PU_'
279 setPrimaryDs =
'RelVal'+s[1].
split(
'+')[0]
281 chainDict[
'nowmTasklist'][-1][
'PrimaryDataset']=setPrimaryDs
287 chainDict[
'nowmTasklist'][-1][
'nowmIO']=json.loads(open(
'%s/%s.io'%(dir,step)).
read())
289 print "Failed to find",
'%s/%s.io'%(dir,step),
".The workflows were probably not run on cfg not created"
292 chainDict[
'nowmTasklist'][-1][
'LumisPerJob']=splitForThisWf
294 chainDict[
'nowmTasklist'][-1][
'LumisPerJob']=wmsplit[step]
297 if 'Hadronizer' in step:
298 chainDict[
'nowmTasklist'][-1][
'LumisPerJob']=wmsplit[
'Hadronizer']
301 chainDict[
'nowmTasklist'][-1][
'TaskName']=step
303 chainDict[
'nowmTasklist'][-1][
'PrimaryDataset']=setPrimaryDs
304 chainDict[
'nowmTasklist'][-1][
'ConfigCacheID']=
'%s/%s.py'%(dir,step)
305 chainDict[
'nowmTasklist'][-1][
'GlobalTag']=chainDict[
'nowmTasklist'][-1][
'nowmIO'][
'GT']
306 chainDict[
'GlobalTag']=chainDict[
'nowmTasklist'][-1][
'nowmIO'][
'GT']
307 if 'pileup' in chainDict[
'nowmTasklist'][-1][
'nowmIO']:
308 chainDict[
'nowmTasklist'][-1][
'MCPileup']=chainDict[
'nowmTasklist'][-1][
'nowmIO'][
'pileup']
309 if '--pileup ' in s[2][index]:
310 processStrPrefix=
'PU_'
312 processStrPrefix=
'PU25ns_'
314 processStrPrefix=
'PU50ns_'
315 if 'DIGIPREMIX_S2' in s[2][index] :
317 processStrPrefix=
'PUpmx25ns_'
318 elif s[2][index].
split()[ s[2][index].
split().
index(
'--pileup_input')+1 ].
find(
'50ns') > 0 :
319 processStrPrefix=
'PUpmx50ns_'
323 chainDict[
'AcquisitionEra'][step]=chainDict[
'CMSSWVersion']
324 chainDict[
'ProcessingString'][step]=processStrPrefix+chainDict[
'nowmTasklist'][-1][
'GlobalTag'].
replace(
'::All',
'')+thisLabel
327 chainDict[
'nowmTasklist'][-1][
'AcquisitionEra']=chainDict[
'CMSSWVersion']
328 chainDict[
'nowmTasklist'][-1][
'ProcessingString']=processStrPrefix+chainDict[
'nowmTasklist'][-1][
'GlobalTag'].
replace(
'::All',
'')+thisLabel
331 if (
'DBLMINIAODMCUP15NODQM' in step):
332 chainDict[
'nowmTasklist'][-1][
'ProcessingString']=chainDict[
'nowmTasklist'][-1][
'ProcessingString']+
'_miniAOD'
334 if( chainDict[
'nowmTasklist'][-1][
'Multicore'] ):
340 chainDict[
'nowmTasklist'][-1][
'Memory'] = 3000 + int( chainDict[
'nowmTasklist'][-1][
'Multicore'] -1 )*1500
344 chainDict[
'RequestString']=
'RV'+chainDict[
'CMSSWVersion']+s[1].
split(
'+')[0]
345 if processStrPrefix
or thisLabel:
346 chainDict[
'RequestString']+=
'_'+processStrPrefix+thisLabel
355 for i_second
in reversed(range(len(chainDict[
'nowmTasklist']))):
356 t_second=chainDict[
'nowmTasklist'][i_second]
358 if 'primary' in t_second[
'nowmIO']:
360 primary=t_second[
'nowmIO'][
'primary'][0].
replace(
'file:',
'')
361 for i_input
in reversed(range(0,i_second)):
362 t_input=chainDict[
'nowmTasklist'][i_input]
363 for (om,o)
in t_input[
'nowmIO'].
items():
366 t_second[
'InputTask'] = t_input[
'TaskName']
367 t_second[
'InputFromOutputModule'] = om
369 if t_second[
'TaskName'].startswith(
'HARVEST'):
371 chainDict[
'DQMConfigCacheID']=t_second[
'ConfigCacheID']
381 chainDict[
'AcquisitionEra'] = chainDict[
'AcquisitionEra'].
values()[0]
387 if type(i)==int
and i < len(chainDict[
'nowmTasklist']):
388 chainDict[
'nowmTasklist'][i][
'KeepOutput']=
True
389 for (i,t)
in enumerate(chainDict[
'nowmTasklist']):
390 if t[
'TaskName'].startswith(
'HARVEST'):
394 elif t[
'TaskName']
in self.
keep:
398 chainDict[
'Task%d'%(itask)]=t
405 chainDict[
'TaskChain']=itask
407 chainDict.pop(
'nowmTasklist')
414 labelInCouch=self.
label+
'_'+label
415 cacheName=filePath.split(
'/')[-1]
418 print '\tFake upload of',filePath,
'to couch with label',labelInCouch
422 from modules.wma
import upload_to_couch,DATABASE_NAME
424 print '\n\tUnable to find wmcontrol modules. Please include it in your python path\n'
429 print "Not re-uploading",filePath,
"to",where,
"for",label
432 print "Loading",filePath,
"to",where,
"for",label
434 pool = multiprocessing.Pool(1)
435 cacheIds = pool.map( upload_to_couch_oneArg, [(filePath,labelInCouch,self.
user,self.
group,where)] )
436 cacheId = cacheIds[0]
441 for (n,d)
in self.chainDicts.items():
443 if it.startswith(
"Task")
and it!=
'TaskChain':
445 couchID=self.
uploadConf(d[it][
'ConfigCacheID'],
446 str(n)+d[it][
'TaskName'],
449 print d[it][
'ConfigCacheID'],
" uploaded to couchDB for",str(n),
"with ID",couchID
450 d[it][
'ConfigCacheID']=couchID
451 if it ==
'DQMConfigCacheID':
452 couchID=self.
uploadConf(d[
'DQMConfigCacheID'],
456 print d[
'DQMConfigCacheID'],
"uploaded to couchDB for",str(n),
"with ID",couchID
457 d[
'DQMConfigCacheID']=couchID
462 from modules.wma
import makeRequest,approveRequest
463 from wmcontrol
import random_sleep
464 print '\n\tFound wmcontrol\n'
466 print '\n\tUnable to find wmcontrol modules. Please include it in your python path\n'
472 for (n,d)
in self.chainDicts.items():
474 print "Only viewing request",n
475 print pprint.pprint(d)
478 print "For eyes before submitting",n
479 print pprint.pprint(d)
480 print "Submitting",n,
"..........."
481 workFlow=makeRequest(self.
wmagent,d,encodeDict=
True)
482 approveRequest(self.
wmagent,workFlow)
483 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