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[
'DIGIHISt3']=5
172 wmsplit[
'RECODSplit']=1
173 wmsplit[
'SingleMuPt10_UP15_ID']=1
174 wmsplit[
'DIGIUP15_ID']=1
175 wmsplit[
'RECOUP15_ID']=1
176 wmsplit[
'TTbar_13_ID']=1
177 wmsplit[
'SingleMuPt10FS_ID']=1
178 wmsplit[
'TTbarFS_ID']=1
183 print "Not set up for step splitting"
187 for (n,dir)
in directories.items():
189 print "inspecting",dir
191 for (x,s)
in mReader.workFlowSteps.items():
201 if len( [step
for step
in s[3]
if "HARVESTGEN" in step] )>0:
202 chainDict[
'TimePerEvent']=0.1
203 thisLabel=thisLabel+
"_gen"
208 if 'INPUT' in step
or (
not isinstance(s[2][index],str)):
209 nextHasDSInput=s[2][index]
217 chainDict[
'nowmTasklist'][-1][
'nowmIO']=json.loads(open(
'%s/%s.io'%(dir,step)).
read())
219 print "Failed to find",
'%s/%s.io'%(dir,step),
".The workflows were probably not run on cfg not created"
222 chainDict[
'nowmTasklist'][-1][
'PrimaryDataset']=
'RelVal'+s[1].
split(
'+')[0]
223 if not '--relval' in s[2][index]:
224 print 'Impossible to create task from scratch without splitting information with --relval'
227 arg=s[2][index].
split()
228 ns=
map(int,arg[arg.index(
'--relval')+1].
split(
','))
229 chainDict[
'nowmTasklist'][-1][
'RequestNumEvents'] = ns[0]
230 chainDict[
'nowmTasklist'][-1][
'EventsPerJob'] = ns[1]
231 if 'FASTSIM' in s[2][index]
or '--fast' in s[2][index]:
232 thisLabel+=
'_FastSim'
233 if 'lhe' in s[2][index]
in s[2][index]:
234 chainDict[
'nowmTasklist'][-1][
'LheInputFiles'] =
True
239 chainDict[
'nowmTasklist'][-1][
'nowmIO']=json.loads(open(
'%s/%s.io'%(dir,step)).
read())
241 print "Failed to find",
'%s/%s.io'%(dir,step),
".The workflows were probably not run on cfg not created"
243 chainDict[
'nowmTasklist'][-1][
'InputDataset']=nextHasDSInput.dataSet
244 splitForThisWf=nextHasDSInput.split
245 chainDict[
'nowmTasklist'][-1][
'LumisPerJob']=splitForThisWf
247 chainDict[
'nowmTasklist'][-1][
'LumisPerJob']=wmsplit[step]
249 if len(nextHasDSInput.run):
250 chainDict[
'nowmTasklist'][-1][
'RunWhitelist']=nextHasDSInput.run
251 if len(nextHasDSInput.ls):
252 chainDict[
'nowmTasklist'][-1][
'LumiList']=nextHasDSInput.ls
254 if '--data' in s[2][index]
and nextHasDSInput.label:
255 thisLabel+=
'_RelVal_%s'%nextHasDSInput.label
256 if 'filter' in chainDict[
'nowmTasklist'][-1][
'nowmIO']:
257 print "This has an input DS and a filter sequence: very likely to be the PyQuen sample"
258 processStrPrefix=
'PU_'
259 setPrimaryDs =
'RelVal'+s[1].
split(
'+')[0]
261 chainDict[
'nowmTasklist'][-1][
'PrimaryDataset']=setPrimaryDs
267 chainDict[
'nowmTasklist'][-1][
'nowmIO']=json.loads(open(
'%s/%s.io'%(dir,step)).
read())
269 print "Failed to find",
'%s/%s.io'%(dir,step),
".The workflows were probably not run on cfg not created"
272 chainDict[
'nowmTasklist'][-1][
'LumisPerJob']=splitForThisWf
274 chainDict[
'nowmTasklist'][-1][
'LumisPerJob']=wmsplit[step]
277 chainDict[
'nowmTasklist'][-1][
'TaskName']=step
279 chainDict[
'nowmTasklist'][-1][
'PrimaryDataset']=setPrimaryDs
280 chainDict[
'nowmTasklist'][-1][
'ConfigCacheID']=
'%s/%s.py'%(dir,step)
281 chainDict[
'nowmTasklist'][-1][
'GlobalTag']=chainDict[
'nowmTasklist'][-1][
'nowmIO'][
'GT']
282 chainDict[
'GlobalTag']=chainDict[
'nowmTasklist'][-1][
'nowmIO'][
'GT']
283 if 'pileup' in chainDict[
'nowmTasklist'][-1][
'nowmIO']:
284 chainDict[
'nowmTasklist'][-1][
'MCPileup']=chainDict[
'nowmTasklist'][-1][
'nowmIO'][
'pileup']
285 if '--pileup ' in s[2][index]:
286 processStrPrefix=
'PU_'
288 processStrPrefix=
'PU25ns_'
290 processStrPrefix=
'PU50ns_'
291 if 'DIGIPREMIX_S2' in s[2][index] :
293 processStrPrefix=
'PUpmx25ns_'
294 elif s[2][index].
split()[ s[2][index].
split().
index(
'--pileup_input')+1 ].
find(
'50ns') > 0 :
295 processStrPrefix=
'PUpmx50ns_'
299 chainDict[
'AcquisitionEra'][step]=chainDict[
'CMSSWVersion']
300 chainDict[
'ProcessingString'][step]=processStrPrefix+chainDict[
'nowmTasklist'][-1][
'GlobalTag'].
replace(
'::All',
'')+thisLabel
303 chainDict[
'nowmTasklist'][-1][
'AcquisitionEra']=chainDict[
'CMSSWVersion']
304 chainDict[
'nowmTasklist'][-1][
'ProcessingString']=processStrPrefix+chainDict[
'nowmTasklist'][-1][
'GlobalTag'].
replace(
'::All',
'')+thisLabel
308 chainDict[
'RequestString']=
'RV'+chainDict[
'CMSSWVersion']+s[1].
split(
'+')[0]
309 if processStrPrefix
or thisLabel:
310 chainDict[
'RequestString']+=
'_'+processStrPrefix+thisLabel
319 for i_second
in reversed(range(len(chainDict[
'nowmTasklist']))):
320 t_second=chainDict[
'nowmTasklist'][i_second]
322 if 'primary' in t_second[
'nowmIO']:
324 primary=t_second[
'nowmIO'][
'primary'][0].
replace(
'file:',
'')
325 for i_input
in reversed(range(0,i_second)):
326 t_input=chainDict[
'nowmTasklist'][i_input]
327 for (om,o)
in t_input[
'nowmIO'].items():
330 t_second[
'InputTask'] = t_input[
'TaskName']
331 t_second[
'InputFromOutputModule'] = om
333 if t_second[
'TaskName'].startswith(
'HARVEST'):
335 chainDict[
'DQMConfigCacheID']=t_second[
'ConfigCacheID']
345 chainDict[
'AcquisitionEra'] = chainDict[
'AcquisitionEra'].
values()[0]
351 if type(i)==int
and i < len(chainDict[
'nowmTasklist']):
352 chainDict[
'nowmTasklist'][i][
'KeepOutput']=
True
353 for (i,t)
in enumerate(chainDict[
'nowmTasklist']):
354 if t[
'TaskName'].startswith(
'HARVEST'):
358 elif t[
'TaskName']
in self.
keep:
362 chainDict[
'Task%d'%(itask)]=t
369 chainDict[
'TaskChain']=itask
371 chainDict.pop(
'nowmTasklist')
378 labelInCouch=self.
label+
'_'+label
379 cacheName=filePath.split(
'/')[-1]
382 print '\tFake upload of',filePath,
'to couch with label',labelInCouch
386 from modules.wma
import upload_to_couch,DATABASE_NAME
388 print '\n\tUnable to find wmcontrol modules. Please include it in your python path\n'
393 print "Not re-uploading",filePath,
"to",where,
"for",label
396 print "Loading",filePath,
"to",where,
"for",label
398 pool = multiprocessing.Pool(1)
399 cacheIds = pool.map( upload_to_couch_oneArg, [(filePath,labelInCouch,self.
user,self.
group,where)] )
400 cacheId = cacheIds[0]
405 for (n,d)
in self.chainDicts.items():
407 if it.startswith(
"Task")
and it!=
'TaskChain':
409 couchID=self.
uploadConf(d[it][
'ConfigCacheID'],
410 str(n)+d[it][
'TaskName'],
413 print d[it][
'ConfigCacheID'],
" uploaded to couchDB for",str(n),
"with ID",couchID
414 d[it][
'ConfigCacheID']=couchID
415 if it ==
'DQMConfigCacheID':
416 couchID=self.
uploadConf(d[
'DQMConfigCacheID'],
420 print d[
'DQMConfigCacheID'],
"uploaded to couchDB for",str(n),
"with ID",couchID
421 d[
'DQMConfigCacheID']=couchID
426 from modules.wma
import makeRequest,approveRequest
427 from wmcontrol
import random_sleep
428 print '\n\tFound wmcontrol\n'
430 print '\n\tUnable to find wmcontrol modules. Please include it in your python path\n'
436 for (n,d)
in self.chainDicts.items():
438 print "Only viewing request",n
439 print pprint.pprint(d)
442 print "For eyes before submitting",n
443 print pprint.pprint(d)
444 print "Submitting",n,
"..........."
445 workFlow=makeRequest(self.
wmagent,d,encodeDict=
True)
446 approveRequest(self.
wmagent,workFlow)
447 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