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.nThreads==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')
60 self.
dqmgui=
"https://cmsweb.cern.ch/dqm/relval"
65 self.
user = os.getenv(
'USER')
73 if not os.getenv(
'WMCORE_ROOT'):
74 print '\n\twmclient is not setup properly. Will not be able to upload or submit requests.\n'
79 print '\n\tFound wmclient\n'
82 "RequestType" :
"TaskChain",
83 "Requestor": self.
user,
85 "CMSSWVersion": os.getenv(
'CMSSW_VERSION'),
86 "Campaign": os.getenv(
'CMSSW_VERSION'),
87 "ScramArch": os.getenv(
'SCRAM_ARCH'),
88 "ProcessingVersion": self.
version,
90 "CouchURL": self.
couch,
91 "ConfigCacheURL": self.
couch,
92 "DbsUrl":
"https://cmsweb.cern.ch/dbs/prod/global/DBSReader",
97 "unmergedLFNBase" :
"/store/unmerged",
98 "mergedLFNBase" :
"/store/relval",
99 "dashboardActivity" :
"relval",
101 "SizePerEvent" : 1234,
106 "EnableHarvesting" :
"True",
107 "DQMUploadUrl" : self.
dqmgui,
108 "DQMConfigCacheID" :
None
113 "ConfigCacheID" :
None,
115 "SplittingAlgo" :
"EventBased",
116 "EventsPerJob" :
None,
117 "RequestNumEvents" :
None,
118 "Seeding" :
"AutomaticSeeding",
119 "PrimaryDataset" :
None,
124 "TaskName" :
"DigiHLT",
125 "ConfigCacheID" :
None,
127 "InputDataset" :
None,
128 "SplittingAlgo" :
"LumiBased",
136 "InputFromOutputModule" :
None,
137 "ConfigCacheID" :
None,
139 "SplittingAlgo" :
"LumiBased",
148 def prepare(self,mReader, directories, mode='init'):
155 wmsplit[
'RECODreHLT']=2
159 wmsplit[
'DIGIUP15_PU50']=1
160 wmsplit[
'RECOUP15_PU50']=1
161 wmsplit[
'DIGIUP15_PU25']=1
162 wmsplit[
'RECOUP15_PU25']=1
163 wmsplit[
'DIGIHISt3']=5
164 wmsplit[
'RECODSplit']=1
165 wmsplit[
'SingleMuPt10_ID']=1
168 wmsplit[
'TTbar_ID']=1
169 wmsplit[
'SingleMuPt10FS_ID']=1
170 wmsplit[
'TTbarFS_ID']=1
175 print "Not set up for step splitting"
179 for (n,dir)
in directories.items():
181 print "inspecting",dir
183 for (x,s)
in mReader.workFlowSteps.items():
196 if 'INPUT' in step
or (
not isinstance(s[2][index],str)):
197 nextHasDSInput=s[2][index]
205 chainDict[
'nowmTasklist'][-1][
'nowmIO']=json.loads(open(
'%s/%s.io'%(dir,step)).
read())
207 print "Failed to find",
'%s/%s.io'%(dir,step),
".The workflows were probably not run on cfg not created"
210 chainDict[
'nowmTasklist'][-1][
'PrimaryDataset']=
'RelVal'+s[1].
split(
'+')[0]
211 if not '--relval' in s[2][index]:
212 print 'Impossible to create task from scratch without splitting information with --relval'
215 arg=s[2][index].
split()
216 ns=
map(int,arg[arg.index(
'--relval')+1].
split(
','))
217 chainDict[
'nowmTasklist'][-1][
'RequestNumEvents'] = ns[0]
218 chainDict[
'nowmTasklist'][-1][
'EventsPerJob'] = ns[1]
219 if 'FASTSIM' in s[2][index]
or '--fast' in s[2][index]:
220 thisLabel+=
'_FastSim'
221 if 'lhe' in s[2][index]
in s[2][index]:
222 chainDict[
'nowmTasklist'][-1][
'LheInputFiles'] =
True
227 chainDict[
'nowmTasklist'][-1][
'nowmIO']=json.loads(open(
'%s/%s.io'%(dir,step)).
read())
229 print "Failed to find",
'%s/%s.io'%(dir,step),
".The workflows were probably not run on cfg not created"
231 chainDict[
'nowmTasklist'][-1][
'InputDataset']=nextHasDSInput.dataSet
232 splitForThisWf=nextHasDSInput.split
233 chainDict[
'nowmTasklist'][-1][
'LumisPerJob']=splitForThisWf
235 chainDict[
'nowmTasklist'][-1][
'LumisPerJob']=wmsplit[step]
237 if len(nextHasDSInput.run):
238 chainDict[
'nowmTasklist'][-1][
'RunWhitelist']=nextHasDSInput.run
240 if '--data' in s[2][index]
and nextHasDSInput.label:
241 thisLabel+=
'_RelVal_%s'%nextHasDSInput.label
242 if 'filter' in chainDict[
'nowmTasklist'][-1][
'nowmIO']:
243 print "This has an input DS and a filter sequence: very likely to be the PyQuen sample"
244 processStrPrefix=
'PU_'
245 setPrimaryDs =
'RelVal'+s[1].
split(
'+')[0]
247 chainDict[
'nowmTasklist'][-1][
'PrimaryDataset']=setPrimaryDs
253 chainDict[
'nowmTasklist'][-1][
'nowmIO']=json.loads(open(
'%s/%s.io'%(dir,step)).
read())
255 print "Failed to find",
'%s/%s.io'%(dir,step),
".The workflows were probably not run on cfg not created"
258 chainDict[
'nowmTasklist'][-1][
'LumisPerJob']=splitForThisWf
260 chainDict[
'nowmTasklist'][-1][
'LumisPerJob']=wmsplit[step]
263 chainDict[
'nowmTasklist'][-1][
'TaskName']=step
265 chainDict[
'nowmTasklist'][-1][
'PrimaryDataset']=setPrimaryDs
266 chainDict[
'nowmTasklist'][-1][
'ConfigCacheID']=
'%s/%s.py'%(dir,step)
267 chainDict[
'nowmTasklist'][-1][
'GlobalTag']=chainDict[
'nowmTasklist'][-1][
'nowmIO'][
'GT']
268 chainDict[
'GlobalTag']=chainDict[
'nowmTasklist'][-1][
'nowmIO'][
'GT']
269 if 'pileup' in chainDict[
'nowmTasklist'][-1][
'nowmIO']:
270 chainDict[
'nowmTasklist'][-1][
'MCPileup']=chainDict[
'nowmTasklist'][-1][
'nowmIO'][
'pileup']
271 if '--pileup ' in s[2][index]:
272 processStrPrefix=
'PU_'
274 processStrPrefix=
'PU25ns_'
276 processStrPrefix=
'PU50ns_'
277 if 'DIGIPREMIX_S2' in s[2][index] :
279 processStrPrefix=
'PUpmx25ns_'
280 elif s[2][index].
split()[ s[2][index].
split().
index(
'--pileup_input')+1 ].
find(
'50ns') > 0 :
281 processStrPrefix=
'PUpmx50ns_'
285 chainDict[
'AcquisitionEra'][step]=chainDict[
'CMSSWVersion']
286 chainDict[
'ProcessingString'][step]=processStrPrefix+chainDict[
'nowmTasklist'][-1][
'GlobalTag'].
replace(
'::All',
'')+thisLabel
289 chainDict[
'nowmTasklist'][-1][
'AcquisitionEra']=chainDict[
'CMSSWVersion']
290 chainDict[
'nowmTasklist'][-1][
'ProcessingString']=processStrPrefix+chainDict[
'nowmTasklist'][-1][
'GlobalTag'].
replace(
'::All',
'')+thisLabel
294 chainDict[
'RequestString']=
'RV'+chainDict[
'CMSSWVersion']+s[1].
split(
'+')[0]
295 if processStrPrefix
or thisLabel:
296 chainDict[
'RequestString']+=
'_'+processStrPrefix+thisLabel
305 for i_second
in reversed(range(len(chainDict[
'nowmTasklist']))):
306 t_second=chainDict[
'nowmTasklist'][i_second]
308 if 'primary' in t_second[
'nowmIO']:
310 primary=t_second[
'nowmIO'][
'primary'][0].
replace(
'file:',
'')
311 for i_input
in reversed(range(0,i_second)):
312 t_input=chainDict[
'nowmTasklist'][i_input]
313 for (om,o)
in t_input[
'nowmIO'].items():
316 t_second[
'InputTask'] = t_input[
'TaskName']
317 t_second[
'InputFromOutputModule'] = om
319 if t_second[
'TaskName'].startswith(
'HARVEST'):
321 chainDict[
'DQMConfigCacheID']=t_second[
'ConfigCacheID']
331 chainDict[
'AcquisitionEra'] = chainDict[
'AcquisitionEra'].
values()[0]
337 if type(i)==int
and i < len(chainDict[
'nowmTasklist']):
338 chainDict[
'nowmTasklist'][i][
'KeepOutput']=
True
339 for (i,t)
in enumerate(chainDict[
'nowmTasklist']):
340 if t[
'TaskName'].startswith(
'HARVEST'):
344 elif t[
'TaskName']
in self.
keep:
348 chainDict[
'Task%d'%(itask)]=t
355 chainDict[
'TaskChain']=itask
357 chainDict.pop(
'nowmTasklist')
364 labelInCouch=self.
label+
'_'+label
365 cacheName=filePath.split(
'/')[-1]
368 print '\tFake upload of',filePath,
'to couch with label',labelInCouch
372 from modules.wma
import upload_to_couch,DATABASE_NAME
374 print '\n\tUnable to find wmcontrol modules. Please include it in your python path\n'
379 print "Not re-uploading",filePath,
"to",where,
"for",label
382 print "Loading",filePath,
"to",where,
"for",label
384 pool = multiprocessing.Pool(1)
385 cacheIds = pool.map( upload_to_couch_oneArg, [(filePath,labelInCouch,self.
user,self.
group,where)] )
386 cacheId = cacheIds[0]
391 for (n,d)
in self.chainDicts.items():
393 if it.startswith(
"Task")
and it!=
'TaskChain':
395 couchID=self.
uploadConf(d[it][
'ConfigCacheID'],
396 str(n)+d[it][
'TaskName'],
399 print d[it][
'ConfigCacheID'],
" uploaded to couchDB for",str(n),
"with ID",couchID
400 d[it][
'ConfigCacheID']=couchID
401 if it ==
'DQMConfigCacheID':
402 couchID=self.
uploadConf(d[
'DQMConfigCacheID'],
406 print d[
'DQMConfigCacheID'],
"uploaded to couchDB for",str(n),
"with ID",couchID
407 d[
'DQMConfigCacheID']=couchID
412 from modules.wma
import makeRequest,approveRequest
413 from wmcontrol
import random_sleep
414 print '\n\tFound wmcontrol\n'
416 print '\n\tUnable to find wmcontrol modules. Please include it in your python path\n'
422 for (n,d)
in self.chainDicts.items():
424 print "Only viewing request",n
425 print pprint.pprint(d)
428 print "For eyes before submitting",n
429 print pprint.pprint(d)
430 print "Submitting",n,
"..........."
431 workFlow=makeRequest(self.
wmagent,d,encodeDict=
True)
432 approveRequest(self.
wmagent,workFlow)
433 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