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'] ):
338 chainDict[
'nowmTasklist'][-1][
'Memory'] = 3000 + int( chainDict[
'nowmTasklist'][-1][
'Multicore'] -1 )*1200
342 chainDict[
'RequestString']=
'RV'+chainDict[
'CMSSWVersion']+s[1].
split(
'+')[0]
343 if processStrPrefix
or thisLabel:
344 chainDict[
'RequestString']+=
'_'+processStrPrefix+thisLabel
353 for i_second
in reversed(range(len(chainDict[
'nowmTasklist']))):
354 t_second=chainDict[
'nowmTasklist'][i_second]
356 if 'primary' in t_second[
'nowmIO']:
358 primary=t_second[
'nowmIO'][
'primary'][0].
replace(
'file:',
'')
359 for i_input
in reversed(range(0,i_second)):
360 t_input=chainDict[
'nowmTasklist'][i_input]
361 for (om,o)
in t_input[
'nowmIO'].items():
364 t_second[
'InputTask'] = t_input[
'TaskName']
365 t_second[
'InputFromOutputModule'] = om
367 if t_second[
'TaskName'].startswith(
'HARVEST'):
369 chainDict[
'DQMConfigCacheID']=t_second[
'ConfigCacheID']
379 chainDict[
'AcquisitionEra'] = chainDict[
'AcquisitionEra'].
values()[0]
385 if type(i)==int
and i < len(chainDict[
'nowmTasklist']):
386 chainDict[
'nowmTasklist'][i][
'KeepOutput']=
True
387 for (i,t)
in enumerate(chainDict[
'nowmTasklist']):
388 if t[
'TaskName'].startswith(
'HARVEST'):
392 elif t[
'TaskName']
in self.
keep:
396 chainDict[
'Task%d'%(itask)]=t
403 chainDict[
'TaskChain']=itask
405 chainDict.pop(
'nowmTasklist')
412 labelInCouch=self.
label+
'_'+label
413 cacheName=filePath.split(
'/')[-1]
416 print '\tFake upload of',filePath,
'to couch with label',labelInCouch
420 from modules.wma
import upload_to_couch,DATABASE_NAME
422 print '\n\tUnable to find wmcontrol modules. Please include it in your python path\n'
427 print "Not re-uploading",filePath,
"to",where,
"for",label
430 print "Loading",filePath,
"to",where,
"for",label
432 pool = multiprocessing.Pool(1)
433 cacheIds = pool.map( upload_to_couch_oneArg, [(filePath,labelInCouch,self.
user,self.
group,where)] )
434 cacheId = cacheIds[0]
439 for (n,d)
in self.chainDicts.items():
441 if it.startswith(
"Task")
and it!=
'TaskChain':
443 couchID=self.
uploadConf(d[it][
'ConfigCacheID'],
444 str(n)+d[it][
'TaskName'],
447 print d[it][
'ConfigCacheID'],
" uploaded to couchDB for",str(n),
"with ID",couchID
448 d[it][
'ConfigCacheID']=couchID
449 if it ==
'DQMConfigCacheID':
450 couchID=self.
uploadConf(d[
'DQMConfigCacheID'],
454 print d[
'DQMConfigCacheID'],
"uploaded to couchDB for",str(n),
"with ID",couchID
455 d[
'DQMConfigCacheID']=couchID
460 from modules.wma
import makeRequest,approveRequest
461 from wmcontrol
import random_sleep
462 print '\n\tFound wmcontrol\n'
464 print '\n\tUnable to find wmcontrol modules. Please include it in your python path\n'
470 for (n,d)
in self.chainDicts.items():
472 print "Only viewing request",n
473 print pprint.pprint(d)
476 print "For eyes before submitting",n
477 print pprint.pprint(d)
478 print "Submitting",n,
"..........."
479 workFlow=makeRequest(self.
wmagent,d,encodeDict=
True)
480 approveRequest(self.
wmagent,workFlow)
481 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