ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/cms_cmssw.py
Revision: 1.399
Committed: Mon Sep 9 12:45:09 2013 UTC (11 years, 7 months ago) by belforte
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_9_1_pre1
Changes since 1.398: +8 -8 lines
Log Message:
make sure PSETHASH is always defined: https://savannah.cern.ch/bugs/?95570

File Contents

# User Rev Content
1 spiga 1.358
2 belforte 1.399 __revision__ = "$Id: cms_cmssw.py,v 1.398 2013/09/02 14:47:44 belforte Exp $"
3     __version__ = "$Revision: 1.398 $"
4 spiga 1.358
5 slacapra 1.1 from JobType import JobType
6     from crab_exceptions import *
7     from crab_util import *
8     import common
9 ewv 1.363 import re
10 slacapra 1.1 import Scram
11 spiga 1.269 from Splitter import JobSplitter
12 ewv 1.355 from Downloader import Downloader
13 ewv 1.363 try:
14 fanzago 1.360 import json
15     except:
16     import simplejson as json
17 slacapra 1.1
18 spiga 1.293 from IMProv.IMProvNode import IMProvNode
19 ewv 1.355 from IMProv.IMProvLoader import loadIMProvFile
20 belforte 1.388 from WMCore.SiteScreening.BlackWhiteListParser import SEBlackWhiteListParser
21    
22 slacapra 1.105 import os, string, glob
23 ewv 1.355 from xml.dom import pulldom
24 slacapra 1.1
25     class Cmssw(JobType):
26 spiga 1.208 def __init__(self, cfg_params, ncjobs,skip_blocks, isNew):
27 slacapra 1.1 JobType.__init__(self, 'CMSSW')
28 spiga 1.304 common.logger.debug('CMSSW::__init__')
29 spiga 1.208 self.skip_blocks = skip_blocks
30 farinafa 1.346 self.argsList = 2
31 spiga 1.315 self.NumEvents=0
32 gutsche 1.3 self._params = {}
33     self.cfg_params = cfg_params
34 fanzago 1.368 ### FOR MULTI ###
35 fanzago 1.360 self.var_filter=''
36 ewv 1.254
37 spiga 1.234 ### Temporary patch to automatically skip the ISB size check:
38 ewv 1.319 self.server = self.cfg_params.get('CRAB.server_name',None) or \
39     self.cfg_params.get('CRAB.use_server',0)
40 mcinquil 1.340 self.local = common.scheduler.name().upper() in ['LSF','CAF','CONDOR','SGE','PBS']
41 ewv 1.250 size = 9.5
42 belforte 1.395 if self.server or \
43     common.scheduler.name().upper() == 'REMOTEGLIDEIN' :
44 spiga 1.366 size = 100
45 spiga 1.365 elif self.local:
46     size = 9999999
47 belforte 1.397
48     self.MaxTarBallSize = size
49 gutsche 1.72
50 gutsche 1.44 # number of jobs requested to be created, limit obj splitting
51 gutsche 1.38 self.ncjobs = ncjobs
52    
53 slacapra 1.1 self.scram = Scram.Scram(cfg_params)
54     self.additional_inbox_files = []
55     self.scriptExe = ''
56     self.executable = ''
57 slacapra 1.71 self.executable_arch = self.scram.getArch()
58 spiga 1.320 self.tgz_name = 'default.tgz'
59 corvo 1.56 self.scriptName = 'CMSSW.sh'
60 ewv 1.192 self.pset = ''
61 spiga 1.187 self.datasetPath = ''
62 gutsche 1.3
63 spiga 1.300 self.tgzNameWithPath = common.work_space.pathForTgz()+self.tgz_name
64 gutsche 1.50 # set FJR file name
65     self.fjrFileName = 'crab_fjr.xml'
66    
67 slacapra 1.1 self.version = self.scram.getSWVersion()
68 spiga 1.304 common.logger.log(10-1,"CMSSW version is: "+str(self.version))
69 spiga 1.324 version_array = self.version.split('_')
70     self.CMSSW_major = 0
71     self.CMSSW_minor = 0
72     self.CMSSW_patch = 0
73 ewv 1.182 try:
74 spiga 1.324 self.CMSSW_major = int(version_array[1])
75     self.CMSSW_minor = int(version_array[2])
76     self.CMSSW_patch = int(version_array[3])
77 ewv 1.182 except:
78 ewv 1.184 msg = "Cannot parse CMSSW version string: " + self.version + " for major and minor release number!"
79 ewv 1.182 raise CrabException(msg)
80    
81 ewv 1.334 if self.CMSSW_major < 2 or (self.CMSSW_major == 2 and self.CMSSW_minor < 1):
82     msg = "CRAB supports CMSSW >= 2_1_x only. Use an older CRAB version."
83 ewv 1.276 raise CrabException(msg)
84     """
85     As CMSSW versions are dropped we can drop more code:
86 ewv 1.334 2.x dropped: drop check for lumi range setting
87 ewv 1.276 """
88 ewv 1.355 self.checkCMSSWVersion()
89 slacapra 1.1 ### collect Data cards
90 gutsche 1.66
91 fanzago 1.221 ### Temporary: added to remove input file control in the case of PU
92 farinafa 1.224 self.dataset_pu = cfg_params.get('CMSSW.dataset_pu', None)
93 ewv 1.226
94 fanzago 1.368 if not cfg_params.has_key('CMSSW.datasetpath'):
95     msg = "Error: datasetpath not defined in the section [CMSSW] of crab.cfg file "
96 spiga 1.236 raise CrabException(msg)
97 fanzago 1.368 else:
98     tmp = cfg_params['CMSSW.datasetpath']
99     common.logger.log(10-1, "CMSSW::CMSSW(): datasetPath = "+tmp)
100     if string.lower(tmp)=='none':
101     self.datasetPath = None
102     self.selectNoInput = 1
103     self.primaryDataset = 'null'
104     else:
105     self.datasetPath = tmp
106     self.selectNoInput = 0
107     ll = len(self.datasetPath.split("/"))
108 belforte 1.381 if (ll != 4) or self.datasetPath[0] != '/' or self.datasetPath[-1] == '/':
109 fanzago 1.368 msg = 'Your datasetpath has a invalid format ' + self.datasetPath + '\n'
110 belforte 1.380 msg += 'Expected a path in format /PRIMARY/PROCESSED/TIER'
111 fanzago 1.368 raise CrabException(msg)
112     self.primaryDataset = self.datasetPath.split("/")[1]
113     self.dataTier = self.datasetPath.split("/")[2]
114 gutsche 1.5
115 ewv 1.326 # Analysis dataset is primary/processed/tier/definition
116 ewv 1.330 self.ads = False
117     if self.datasetPath:
118     self.ads = len(self.datasetPath.split("/")) > 4
119 spiga 1.354 self.lumiMask = self.cfg_params.get('CMSSW.lumi_mask',None)
120 ewv 1.356 self.lumiParams = self.cfg_params.get('CMSSW.total_number_of_lumis',None) or \
121     self.cfg_params.get('CMSSW.lumis_per_job',None)
122 spiga 1.358
123 ewv 1.327 # FUTURE: Can remove this check
124     if self.ads and self.CMSSW_major < 3:
125     common.logger.info('Warning: Analysis dataset support is incomplete in CMSSW 2_x.')
126     common.logger.info(' Only file level, not lumi level, granularity is supported.')
127    
128 spiga 1.288 self.debugWrap=''
129 fanzago 1.285 self.debug_wrapper = int(cfg_params.get('USER.debug_wrapper',0))
130     if self.debug_wrapper == 1: self.debugWrap='--debug'
131 slacapra 1.291
132 slacapra 1.1 ## now the application
133 ewv 1.313 self.managedGenerators = ['madgraph', 'comphep', 'lhe']
134 ewv 1.258 self.generator = cfg_params.get('CMSSW.generator','pythia').lower()
135 slacapra 1.153 self.executable = cfg_params.get('CMSSW.executable','cmsRun')
136 spiga 1.305 common.logger.log(10-1, "CMSSW::CMSSW(): executable = "+self.executable)
137 slacapra 1.1
138 slacapra 1.153 if not cfg_params.has_key('CMSSW.pset'):
139 slacapra 1.1 raise CrabException("PSet file missing. Cannot run cmsRun ")
140 slacapra 1.153 self.pset = cfg_params['CMSSW.pset']
141 spiga 1.305 common.logger.log(10-1, "Cmssw::Cmssw(): PSet file = "+self.pset)
142 slacapra 1.153 if self.pset.lower() != 'none' :
143     if (not os.path.exists(self.pset)):
144     raise CrabException("User defined PSet file "+self.pset+" does not exist")
145     else:
146     self.pset = None
147 slacapra 1.1
148     # output files
149 slacapra 1.53 ## stuff which must be returned always via sandbox
150     self.output_file_sandbox = []
151    
152     # add fjr report by default via sandbox
153     self.output_file_sandbox.append(self.fjrFileName)
154    
155     # other output files to be returned via sandbox or copied to SE
156 mcinquil 1.216 outfileflag = False
157 slacapra 1.153 self.output_file = []
158     tmp = cfg_params.get('CMSSW.output_file',None)
159     if tmp :
160 slacapra 1.207 self.output_file = [x.strip() for x in tmp.split(',')]
161 mcinquil 1.216 outfileflag = True #output found
162 slacapra 1.1
163 slacapra 1.153 self.scriptExe = cfg_params.get('USER.script_exe',None)
164     if self.scriptExe :
165 slacapra 1.176 if not os.path.isfile(self.scriptExe):
166     msg ="ERROR. file "+self.scriptExe+" not found"
167     raise CrabException(msg)
168     self.additional_inbox_files.append(string.strip(self.scriptExe))
169 slacapra 1.70
170 spiga 1.314 self.AdditionalArgs = cfg_params.get('USER.script_arguments',None)
171     if self.AdditionalArgs : self.AdditionalArgs = string.replace(self.AdditionalArgs,',',' ')
172    
173 spiga 1.42 if self.datasetPath == None and self.pset == None and self.scriptExe == '' :
174 slacapra 1.176 msg ="Error. script_exe not defined"
175     raise CrabException(msg)
176 spiga 1.42
177 ewv 1.226 # use parent files...
178 spiga 1.269 self.useParent = int(self.cfg_params.get('CMSSW.use_parent',0))
179 spiga 1.204
180 slacapra 1.1 ## additional input files
181 slacapra 1.153 if cfg_params.has_key('USER.additional_input_files'):
182 slacapra 1.29 tmpAddFiles = string.split(cfg_params['USER.additional_input_files'],',')
183 slacapra 1.70 for tmp in tmpAddFiles:
184     tmp = string.strip(tmp)
185     dirname = ''
186     if not tmp[0]=="/": dirname = "."
187 corvo 1.85 files = []
188     if string.find(tmp,"*")>-1:
189     files = glob.glob(os.path.join(dirname, tmp))
190     if len(files)==0:
191     raise CrabException("No additional input file found with this pattern: "+tmp)
192     else:
193     files.append(tmp)
194 slacapra 1.70 for file in files:
195     if not os.path.exists(file):
196     raise CrabException("Additional input file not found: "+file)
197 slacapra 1.45 pass
198 slacapra 1.105 self.additional_inbox_files.append(string.strip(file))
199 slacapra 1.1 pass
200     pass
201 spiga 1.304 common.logger.debug("Additional input files: "+str(self.additional_inbox_files))
202 slacapra 1.153 pass
203 gutsche 1.3
204 gutsche 1.35
205 ewv 1.160 ## New method of dealing with seeds
206     self.incrementSeeds = []
207     self.preserveSeeds = []
208     if cfg_params.has_key('CMSSW.preserve_seeds'):
209     tmpList = cfg_params['CMSSW.preserve_seeds'].split(',')
210     for tmp in tmpList:
211     tmp.strip()
212     self.preserveSeeds.append(tmp)
213     if cfg_params.has_key('CMSSW.increment_seeds'):
214     tmpList = cfg_params['CMSSW.increment_seeds'].split(',')
215     for tmp in tmpList:
216     tmp.strip()
217     self.incrementSeeds.append(tmp)
218    
219 fanzago 1.318 # Copy/return/publish
220 slacapra 1.153 self.copy_data = int(cfg_params.get('USER.copy_data',0))
221     self.return_data = int(cfg_params.get('USER.return_data',0))
222 fanzago 1.318 self.publish_data = int(cfg_params.get('USER.publish_data',0))
223     if (self.publish_data == 1):
224     if not cfg_params.has_key('USER.publish_data_name'):
225     raise CrabException('Cannot publish output data, because you did not specify USER.publish_data_name parameter in the crab.cfg file')
226     else:
227     self.processedDataset = cfg_params['USER.publish_data_name']
228 ewv 1.276
229     self.conf = {}
230     self.conf['pubdata'] = None
231 spiga 1.269 # number of jobs requested to be created, limit obj splitting DD
232 slacapra 1.1 #DBSDLS-start
233 ewv 1.131 ## Initialize the variables that are extracted from DBS/DLS and needed in other places of the code
234 slacapra 1.1 self.maxEvents=0 # max events available ( --> check the requested nb. of evts in Creator.py)
235     self.DBSPaths={} # all dbs paths requested ( --> input to the site local discovery script)
236 gutsche 1.35 self.jobDestination=[] # Site destination(s) for each job (list of lists)
237 slacapra 1.1 ## Perform the data location and discovery (based on DBS/DLS)
238 slacapra 1.9 ## SL: Don't if NONE is specified as input (pythia use case)
239 gutsche 1.35 blockSites = {}
240 spiga 1.342 #wmbs
241     self.automation = int(self.cfg_params.get('WMBS.automation',0))
242     if self.automation == 0:
243 belforte 1.388 self.seListParser= SEBlackWhiteListParser(logger=common.logger())
244 spiga 1.342 if self.datasetPath:
245     blockSites = self.DataDiscoveryAndLocation(cfg_params)
246     #DBSDLS-end
247 belforte 1.388 # insert here site override from crab.cfg
248     # note that b/w lists will still be applied
249     if cfg_params.has_key('GRID.data_location_override'):
250     sitesOverride = cfg_params['GRID.data_location_override'].split(',')
251     common.logger.info("DataSite overridden by user to: %s" % sitesOverride)
252     seOverride = self.seListParser.expandList(sitesOverride)
253 belforte 1.398 # beware SiteDB V2 API, cast unicode to string
254     seOverride = map(lambda x:str(x), seOverride)
255 belforte 1.388 common.logger.info("DataLocation overridden by user to: %s\n" % seOverride)
256     for block in blockSites.keys():
257     blockSites[block] = seOverride
258    
259 spiga 1.342 self.conf['blockSites']=blockSites
260 belforte 1.388
261 spiga 1.342 ## Select Splitting
262     splitByRun = int(cfg_params.get('CMSSW.split_by_run',0))
263 ewv 1.347
264 spiga 1.342 if self.selectNoInput:
265     if self.pset == None:
266     self.algo = 'ForScript'
267     else:
268     self.algo = 'NoInput'
269     self.conf['managedGenerators']=self.managedGenerators
270     self.conf['generator']=self.generator
271 ewv 1.356 elif self.ads or self.lumiMask or self.lumiParams:
272 spiga 1.342 self.algo = 'LumiBased'
273 ewv 1.359 if splitByRun:
274     msg = "Cannot combine split by run with lumi_mask, ADS, " \
275     "or lumis_per_job. Use split by lumi mode instead."
276     raise CrabException(msg)
277    
278 spiga 1.342 elif splitByRun ==1:
279     self.algo = 'RunBased'
280 spiga 1.42 else:
281 spiga 1.342 self.algo = 'EventBased'
282     common.logger.debug("Job splitting method: %s" % self.algo)
283 ewv 1.347
284 spiga 1.342 splitter = JobSplitter(self.cfg_params,self.conf)
285     self.dict = splitter.Algos()[self.algo]()
286 gutsche 1.5
287 spiga 1.300 self.argsFile= '%s/arguments.xml'%common.work_space.shareDir()
288     self.rootArgsFilename= 'arguments'
289 spiga 1.208 # modify Pset only the first time
290 spiga 1.320 if isNew:
291     if self.pset != None: self.ModifyPset()
292 spiga 1.300
293 spiga 1.320 ## Prepare inputSandbox TarBall (only the first time)
294     self.tarNameWithPath = self.getTarBall(self.executable)
295 spiga 1.293
296    
297     def ModifyPset(self):
298     import PsetManipulator as pp
299 ewv 1.335
300     # If pycfg_params set, fake out the config script
301     # to make it think it was called with those args
302     pycfg_params = self.cfg_params.get('CMSSW.pycfg_params',None)
303     if pycfg_params:
304     trueArgv = sys.argv
305     sys.argv = [self.pset]
306     sys.argv.extend(pycfg_params.split(' '))
307 spiga 1.293 PsetEdit = pp.PsetManipulator(self.pset)
308 ewv 1.335 if pycfg_params: # Restore original sys.argv
309     sys.argv = trueArgv
310    
311 spiga 1.293 try:
312     # Add FrameworkJobReport to parameter-set, set max events.
313     # Reset later for data jobs by writeCFG which does all modifications
314 ewv 1.295 PsetEdit.maxEvent(1)
315 spiga 1.293 PsetEdit.skipEvent(0)
316     PsetEdit.psetWriter(self.configFilename())
317     ## If present, add TFileService to output files
318 slacapra 1.349 if not int(self.cfg_params.get('CMSSW.skip_tfileservice_output',0)):
319 spiga 1.293 tfsOutput = PsetEdit.getTFileService()
320     if tfsOutput:
321     if tfsOutput in self.output_file:
322 spiga 1.304 common.logger.debug("Output from TFileService "+tfsOutput+" already in output files")
323 spiga 1.293 else:
324     outfileflag = True #output found
325     self.output_file.append(tfsOutput)
326 spiga 1.304 common.logger.info("Adding "+tfsOutput+" (from TFileService) to list of output files")
327 spiga 1.293 pass
328     pass
329 fanzago 1.360
330     # If requested, add PoolOutputModule to output files
331 fanzago 1.368 ### FOR MULTI ###
332 fanzago 1.360 #edmOutput = PsetEdit.getPoolOutputModule()
333     edmOutputDict = PsetEdit.getPoolOutputModule()
334     common.logger.debug("(test) edmOutputDict = "+str(edmOutputDict))
335     filter_dict = {}
336     for key in edmOutputDict.keys():
337     filter_dict[key]=edmOutputDict[key]['dataset']
338     common.logger.debug("(test) filter_dict for multi = "+str(filter_dict))
339    
340     #### in CMSSW.sh: export var_filter
341    
342     self.var_filter = json.dumps(filter_dict)
343     common.logger.debug("(test) var_filter for multi = "+self.var_filter)
344 ewv 1.363
345 fanzago 1.360 edmOutput = edmOutputDict.keys()
346 spiga 1.293 if int(self.cfg_params.get('CMSSW.get_edm_output',0)):
347     if edmOutput:
348 ewv 1.321 for outputFile in edmOutput:
349     if outputFile in self.output_file:
350 ewv 1.325 common.logger.debug("Output from PoolOutputModule "+outputFile+" already in output files")
351 ewv 1.321 else:
352     self.output_file.append(outputFile)
353     common.logger.info("Adding "+outputFile+" (from PoolOutputModule) to list of output files")
354     # not requested, check anyhow to avoid accidental T2 overload
355 slacapra 1.297 else:
356 ewv 1.321 if edmOutput:
357     missedFiles = []
358     for outputFile in edmOutput:
359     if outputFile not in self.output_file:
360     missedFiles.append(outputFile)
361     if missedFiles:
362     msg = "ERROR: PoolOutputModule(s) are present in your ParameteSet %s \n"%self.pset
363     msg += " but the file(s) produced ( %s ) are not in the list of output files\n" % ', '.join(missedFiles)
364     msg += "WARNING: please remove them. If you want to keep them, add the file(s) to output_files or use CMSSW.get_edm_output = 1\n"
365     if int(self.cfg_params.get('CMSSW.ignore_edm_output',0)):
366     msg += " CMSSW.ignore_edm_output==1 : Hope you know what you are doing...\n"
367     common.logger.info(msg)
368 spiga 1.322 else :
369 ewv 1.321 raise CrabException(msg)
370 ewv 1.301
371     if (PsetEdit.getBadFilesSetting()):
372     msg = "WARNING: You have set skipBadFiles to True. This will continue processing on some errors and you may not be notified."
373 spiga 1.304 common.logger.info(msg)
374 ewv 1.301
375 slacapra 1.297 except CrabException, msg:
376 spiga 1.304 common.logger.info(str(msg))
377 slacapra 1.297 msg='Error while manipulating ParameterSet (see previous message, if any): exiting...'
378 spiga 1.293 raise CrabException(msg)
379    
380 ewv 1.363 valid = re.compile('^[\w\.\-]+$')
381     for fileName in self.output_file:
382     if not valid.match(fileName):
383     msg = "The file %s may only contain alphanumeric characters and -, _, ." % fileName
384     raise CrabException(msg)
385    
386 gutsche 1.3
387 slacapra 1.1 def DataDiscoveryAndLocation(self, cfg_params):
388    
389 slacapra 1.86 import DataDiscovery
390     import DataLocation
391 spiga 1.304 common.logger.log(10-1,"CMSSW::DataDiscoveryAndLocation()")
392 gutsche 1.3
393     datasetPath=self.datasetPath
394    
395 slacapra 1.1 ## Contact the DBS
396 spiga 1.304 common.logger.info("Contacting Data Discovery Services ...")
397 slacapra 1.1 try:
398 spiga 1.208 self.pubdata=DataDiscovery.DataDiscovery(datasetPath, cfg_params,self.skip_blocks)
399 slacapra 1.1 self.pubdata.fetchDBSInfo()
400    
401 slacapra 1.41 except DataDiscovery.NotExistingDatasetError, ex :
402 slacapra 1.1 msg = 'ERROR ***: failed Data Discovery in DBS : %s'%ex.getErrorMessage()
403     raise CrabException(msg)
404 slacapra 1.41 except DataDiscovery.NoDataTierinProvenanceError, ex :
405 slacapra 1.1 msg = 'ERROR ***: failed Data Discovery in DBS : %s'%ex.getErrorMessage()
406     raise CrabException(msg)
407 slacapra 1.41 except DataDiscovery.DataDiscoveryError, ex:
408 gutsche 1.66 msg = 'ERROR ***: failed Data Discovery in DBS : %s'%ex.getErrorMessage()
409 slacapra 1.1 raise CrabException(msg)
410    
411 gutsche 1.35 self.filesbyblock=self.pubdata.getFiles()
412 spiga 1.269 self.conf['pubdata']=self.pubdata
413 gutsche 1.3
414 slacapra 1.1 ## get max number of events
415 ewv 1.192 self.maxEvents=self.pubdata.getMaxEvents()
416 slacapra 1.1
417     ## Contact the DLS and build a list of sites hosting the fileblocks
418     try:
419 slacapra 1.41 dataloc=DataLocation.DataLocation(self.filesbyblock.keys(),cfg_params)
420 gutsche 1.6 dataloc.fetchDLSInfo()
421 slacapra 1.263
422 slacapra 1.41 except DataLocation.DataLocationError , ex:
423 slacapra 1.1 msg = 'ERROR ***: failed Data Location in DLS \n %s '%ex.getErrorMessage()
424     raise CrabException(msg)
425 ewv 1.131
426 slacapra 1.1
427 slacapra 1.270 unsorted_sites = dataloc.getSites()
428     sites = self.filesbyblock.fromkeys(self.filesbyblock,'')
429     for lfn in self.filesbyblock.keys():
430     if unsorted_sites.has_key(lfn):
431     sites[lfn]=unsorted_sites[lfn]
432     else:
433     sites[lfn]=[]
434    
435 slacapra 1.264 if len(sites)==0:
436 spiga 1.267 msg = 'ERROR ***: no location for any of the blocks of this dataset: \n\t %s \n'%datasetPath
437     msg += "\tMaybe the dataset is located only at T1's (or at T0), where analysis jobs are not allowed\n"
438     msg += "\tPlease check DataDiscovery page https://cmsweb.cern.ch/dbs_discovery/\n"
439 slacapra 1.264 raise CrabException(msg)
440    
441 gutsche 1.35 allSites = []
442     listSites = sites.values()
443 slacapra 1.63 for listSite in listSites:
444     for oneSite in listSite:
445 gutsche 1.35 allSites.append(oneSite)
446 slacapra 1.291 [allSites.append(it) for it in allSites if not allSites.count(it)]
447 ewv 1.295
448 gutsche 1.3
449 gutsche 1.92 # screen output
450 spiga 1.354 if self.ads or self.lumiMask:
451     common.logger.info("Requested (A)DS %s has %s block(s)." %
452 ewv 1.350 (datasetPath, len(self.filesbyblock.keys())))
453     else:
454     common.logger.info("Requested dataset: " + datasetPath + \
455     " has " + str(self.maxEvents) + " events in " + \
456     str(len(self.filesbyblock.keys())) + " blocks.\n")
457 gutsche 1.92
458 gutsche 1.35 return sites
459 ewv 1.131
460 spiga 1.42
461 spiga 1.208 def split(self, jobParams,firstJobID):
462 ewv 1.276
463 spiga 1.293 jobParams = self.dict['args']
464 spiga 1.269 njobs = self.dict['njobs']
465     self.jobDestination = self.dict['jobDestination']
466 ewv 1.131
467 ewv 1.333 if njobs == 0:
468     raise CrabException("Asked to split zero jobs: aborting")
469 belforte 1.387 if not self.server and not self.local :
470     if common.scheduler.name().upper() == 'REMOTEGLIDEIN' :
471     if njobs > 5000 :
472     raise CrabException("too many jobs. remoteGlidein has a limit at 5000")
473     else :
474     if njobs > 500:
475     msg = "Error: this task contains more than 500 jobs. \n"
476     msg += " The CRAB SA does not submit more than 500 jobs.\n"
477     msg += " Use the server mode. \n"
478     raise CrabException(msg)
479 belforte 1.389 if self.server and njobs > 5000 :
480     raise CrabException("too many jobs. CrabServer has a limit at 5000")
481 gutsche 1.3 # create the empty structure
482     for i in range(njobs):
483     jobParams.append("")
484 ewv 1.131
485 spiga 1.165 listID=[]
486     listField=[]
487 spiga 1.293 listDictions=[]
488 spiga 1.300 exist= os.path.exists(self.argsFile)
489 spiga 1.208 for id in range(njobs):
490     job = id + int(firstJobID)
491 spiga 1.167 listID.append(job+1)
492 spiga 1.162 job_ToSave ={}
493 spiga 1.169 concString = ' '
494 spiga 1.165 argu=''
495 spiga 1.293 str_argu = str(job+1)
496 spiga 1.208 if len(jobParams[id]):
497 ewv 1.295 argu = {'JobID': job+1}
498 spiga 1.293 for i in range(len(jobParams[id])):
499     argu[self.dict['params'][i]]=jobParams[id][i]
500 spiga 1.315 if len(jobParams[id])==1: self.NumEvents = jobParams[id][i]
501 ewv 1.295 # just for debug
502 spiga 1.293 str_argu += concString.join(jobParams[id])
503 spiga 1.314 if argu != '': listDictions.append(argu)
504 ewv 1.347 job_ToSave['arguments']= '%d %d'%( (job+1), 0)
505 spiga 1.208 job_ToSave['dlsDestination']= self.jobDestination[id]
506 spiga 1.165 listField.append(job_ToSave)
507 slacapra 1.311 from ProdCommon.SiteDB.CmsSiteMapper import CmsSEMap
508     cms_se = CmsSEMap()
509 ewv 1.295 msg="Job %s Arguments: %s\n"%(str(job+1),str_argu)
510 spiga 1.293 msg+="\t Destination: %s "%(str(self.jobDestination[id]))
511 slacapra 1.311 SEDestination = [cms_se[dest] for dest in self.jobDestination[id]]
512     msg+="\t CMSDestination: %s "%(str(SEDestination))
513 spiga 1.307 common.logger.log(10-1,msg)
514 spiga 1.293 # write xml
515 ewv 1.295 if len(listDictions):
516 spiga 1.293 if exist==False: self.CreateXML()
517     self.addEntry(listDictions)
518 spiga 1.187 common._db.updateJob_(listID,listField)
519 spiga 1.293 return
520 ewv 1.313
521 spiga 1.293 def CreateXML(self):
522     """
523 ewv 1.295 """
524 spiga 1.300 result = IMProvNode( self.rootArgsFilename )
525     outfile = file( self.argsFile, 'w').write(str(result))
526 ewv 1.295 return
527 spiga 1.293
528     def addEntry(self, listDictions):
529     """
530     _addEntry_
531 ewv 1.295
532 spiga 1.293 add an entry to the xml file
533     """
534     ## load xml
535 spiga 1.300 improvDoc = loadIMProvFile(self.argsFile)
536 spiga 1.293 entrname= 'Job'
537     for dictions in listDictions:
538     report = IMProvNode(entrname , None, **dictions)
539     improvDoc.addNode(report)
540 spiga 1.300 outfile = file( self.argsFile, 'w').write(str(improvDoc))
541 gutsche 1.3 return
542 ewv 1.131
543 gutsche 1.3 def numberOfJobs(self):
544 spiga 1.342 #wmbs
545 ewv 1.347 if self.automation==0:
546 spiga 1.342 return self.dict['njobs']
547     else:
548     return None
549 ewv 1.347
550 slacapra 1.1 def getTarBall(self, exe):
551     """
552     Return the TarBall with lib and exe
553     """
554 spiga 1.320 self.tgzNameWithPath = common.work_space.pathForTgz()+self.tgz_name
555     if os.path.exists(self.tgzNameWithPath):
556     return self.tgzNameWithPath
557 slacapra 1.1
558     # Prepare a tar gzipped file with user binaries.
559     self.buildTar_(exe)
560    
561 spiga 1.320 return string.strip(self.tgzNameWithPath)
562 slacapra 1.1
563     def buildTar_(self, executable):
564    
565     # First of all declare the user Scram area
566     swArea = self.scram.getSWArea_()
567     swReleaseTop = self.scram.getReleaseTop_()
568 ewv 1.131
569 slacapra 1.1 ## check if working area is release top
570     if swReleaseTop == '' or swArea == swReleaseTop:
571 spiga 1.304 common.logger.debug("swArea = "+swArea+" swReleaseTop ="+swReleaseTop)
572 slacapra 1.1 return
573    
574 slacapra 1.61 import tarfile
575     try: # create tar ball
576 spiga 1.320 tar = tarfile.open(self.tgzNameWithPath, "w:gz")
577 slacapra 1.61 ## First find the executable
578 slacapra 1.86 if (self.executable != ''):
579 slacapra 1.61 exeWithPath = self.scram.findFile_(executable)
580     if ( not exeWithPath ):
581     raise CrabException('User executable '+executable+' not found')
582 ewv 1.131
583 slacapra 1.61 ## then check if it's private or not
584     if exeWithPath.find(swReleaseTop) == -1:
585     # the exe is private, so we must ship
586 spiga 1.304 common.logger.debug("Exe "+exeWithPath+" to be tarred")
587 slacapra 1.61 path = swArea+'/'
588 corvo 1.85 # distinguish case when script is in user project area or given by full path somewhere else
589     if exeWithPath.find(path) >= 0 :
590     exe = string.replace(exeWithPath, path,'')
591 slacapra 1.129 tar.add(path+exe,exe)
592 corvo 1.85 else :
593     tar.add(exeWithPath,os.path.basename(executable))
594 slacapra 1.61 pass
595     else:
596     # the exe is from release, we'll find it on WN
597     pass
598 ewv 1.131
599 slacapra 1.61 ## Now get the libraries: only those in local working area
600 slacapra 1.256 tar.dereference=True
601 slacapra 1.61 libDir = 'lib'
602     lib = swArea+'/' +libDir
603 spiga 1.304 common.logger.debug("lib "+lib+" to be tarred")
604 slacapra 1.61 if os.path.exists(lib):
605     tar.add(lib,libDir)
606 ewv 1.131
607 slacapra 1.61 ## Now check if module dir is present
608     moduleDir = 'module'
609     module = swArea + '/' + moduleDir
610     if os.path.isdir(module):
611     tar.add(module,moduleDir)
612 slacapra 1.256 tar.dereference=False
613 slacapra 1.61
614     ## Now check if any data dir(s) is present
615 spiga 1.374 self.dataExist = False
616 slacapra 1.212 todo_list = [(i, i) for i in os.listdir(swArea+"/src")]
617 slacapra 1.206 while len(todo_list):
618     entry, name = todo_list.pop()
619 slacapra 1.211 if name.startswith('crab_0_') or name.startswith('.') or name == 'CVS':
620 slacapra 1.206 continue
621 slacapra 1.212 if os.path.isdir(swArea+"/src/"+entry):
622 slacapra 1.206 entryPath = entry + '/'
623 slacapra 1.212 todo_list += [(entryPath + i, i) for i in os.listdir(swArea+"/src/"+entry)]
624 spiga 1.374 if name == 'data':
625     self.dataExist=True
626     common.logger.debug("data "+entry+" to be tarred")
627     tar.add(swArea+"/src/"+entry,"src/"+entry)
628     pass
629 slacapra 1.206 pass
630 ewv 1.182
631 spiga 1.179 ### CMSSW ParameterSet
632     if not self.pset is None:
633     cfg_file = common.work_space.jobDir()+self.configFilename()
634 ewv 1.357 pickleFile = common.work_space.jobDir()+self.configFilename() + '.pkl'
635 ewv 1.182 tar.add(cfg_file,self.configFilename())
636 ewv 1.357 tar.add(pickleFile,self.configFilename() + '.pkl')
637 ewv 1.313
638 spiga 1.309 try:
639     crab_cfg_file = common.work_space.shareDir()+'/crab.cfg'
640     tar.add(crab_cfg_file,'crab.cfg')
641     except:
642     pass
643 fanzago 1.93
644 fanzago 1.152 ## Add ProdCommon dir to tar
645 slacapra 1.211 prodcommonDir = './'
646     prodcommonPath = os.environ['CRABDIR'] + '/' + 'external/'
647 spiga 1.244 neededStuff = ['ProdCommon/__init__.py','ProdCommon/FwkJobRep', 'ProdCommon/CMSConfigTools', \
648 spiga 1.298 'ProdCommon/Core', 'ProdCommon/MCPayloads', 'IMProv', 'ProdCommon/Storage', \
649     'WMCore/__init__.py','WMCore/Algorithms']
650 slacapra 1.214 for file in neededStuff:
651     tar.add(prodcommonPath+file,prodcommonDir+file)
652 spiga 1.179
653     ##### ML stuff
654     ML_file_list=['report.py', 'DashboardAPI.py', 'Logger.py', 'ProcInfo.py', 'apmon.py']
655     path=os.environ['CRABDIR'] + '/python/'
656     for file in ML_file_list:
657     tar.add(path+file,file)
658    
659     ##### Utils
660 belforte 1.382 Utils_file_list=['parseCrabFjr.py','writeCfg.py', 'fillCrabFjr.py','cmscp.py','crabWatchdog.sh']
661 spiga 1.179 for file in Utils_file_list:
662     tar.add(path+file,file)
663 ewv 1.131
664 ewv 1.182 ##### AdditionalFiles
665 slacapra 1.253 tar.dereference=True
666 spiga 1.179 for file in self.additional_inbox_files:
667     tar.add(file,string.split(file,'/')[-1])
668 slacapra 1.253 tar.dereference=False
669 spiga 1.320 common.logger.log(10-1,"Files in "+self.tgzNameWithPath+" : "+str(tar.getnames()))
670 ewv 1.182
671 slacapra 1.61 tar.close()
672 mcinquil 1.241 except IOError, exc:
673 spiga 1.320 msg = 'Could not create tar-ball %s \n'%self.tgzNameWithPath
674 spiga 1.304 msg += str(exc)
675     raise CrabException(msg)
676 mcinquil 1.241 except tarfile.TarError, exc:
677 spiga 1.320 msg = 'Could not create tar-ball %s \n'%self.tgzNameWithPath
678 spiga 1.304 msg += str(exc)
679     raise CrabException(msg)
680 spiga 1.300
681 gutsche 1.72 tarballinfo = os.stat(self.tgzNameWithPath)
682     if ( tarballinfo.st_size > self.MaxTarBallSize*1024*1024 ) :
683 fanzago 1.385 #### FEDE FOR SAVANNAH BUG 94491 ########
684     cmdOut = runCommand('tar -ztvf %s|sort -n -k3'%self.tgzNameWithPath)
685 spiga 1.365 if not self.server:
686     msg = 'Input sandbox size of ' + str(float(tarballinfo.st_size)/1024.0/1024.0) + ' MB is larger than the allowed ' + \
687     str(self.MaxTarBallSize) +'MB input sandbox limit \n'
688     msg += ' and not supported by the direct GRID submission system.\n'
689 belforte 1.386 msg += ' Please use the CRAB server mode by setting use_server=1 in section [CRAB] of your crab.cfg.\n'
690 fanzago 1.385 msg += ' Content of your default.tgz archive is \n'
691     msg += cmdOut
692 ewv 1.367 else:
693 spiga 1.365 msg = 'Input sandbox size of ' + str(float(tarballinfo.st_size)/1024.0/1024.0) + ' MB is larger than the allowed ' + \
694     str(self.MaxTarBallSize) +'MB input sandbox limit in the server.'
695 fanzago 1.385 msg += 'Content of your default.tgz archive is \n'
696     msg += cmdOut
697 spiga 1.238 raise CrabException(msg)
698 gutsche 1.72
699 slacapra 1.61 ## create tar-ball with ML stuff
700 slacapra 1.97
701 spiga 1.165 def wsSetupEnvironment(self, nj=0):
702 slacapra 1.1 """
703     Returns part of a job script which prepares
704     the execution environment for the job 'nj'.
705     """
706 ewv 1.334 psetName = 'pset.py'
707    
708 slacapra 1.1 # Prepare JobType-independent part
709 ewv 1.160 txt = '\n#Written by cms_cmssw::wsSetupEnvironment\n'
710 fanzago 1.133 txt += 'echo ">>> setup environment"\n'
711 ewv 1.347 txt += 'echo "set SCRAM ARCH to ' + self.executable_arch + '"\n'
712     txt += 'export SCRAM_ARCH=' + self.executable_arch + '\n'
713     txt += 'echo "SCRAM_ARCH = $SCRAM_ARCH"\n'
714 spiga 1.290 txt += 'if [ $middleware == LCG ] || [ $middleware == CAF ] || [ $middleware == LSF ]; then \n'
715 gutsche 1.3 txt += self.wsSetupCMSLCGEnvironment_()
716 ewv 1.283 txt += 'elif [ $middleware == OSG ]; then\n'
717 gutsche 1.43 txt += ' WORKING_DIR=`/bin/mktemp -d $OSG_WN_TMP/cms_XXXXXXXXXXXX`\n'
718 ewv 1.132 txt += ' if [ ! $? == 0 ] ;then\n'
719 fanzago 1.161 txt += ' echo "ERROR ==> OSG $WORKING_DIR could not be created on WN `hostname`"\n'
720     txt += ' job_exit_code=10016\n'
721     txt += ' func_exit\n'
722 gutsche 1.3 txt += ' fi\n'
723 fanzago 1.133 txt += ' echo ">>> Created working directory: $WORKING_DIR"\n'
724 gutsche 1.3 txt += '\n'
725     txt += ' echo "Change to working directory: $WORKING_DIR"\n'
726     txt += ' cd $WORKING_DIR\n'
727 fanzago 1.133 txt += ' echo ">>> current directory (WORKING_DIR): $WORKING_DIR"\n'
728 ewv 1.131 txt += self.wsSetupCMSOSGEnvironment_()
729 spiga 1.282 #Setup SGE Environment
730 ewv 1.283 txt += 'elif [ $middleware == SGE ]; then\n'
731 spiga 1.282 txt += self.wsSetupCMSLCGEnvironment_()
732    
733 edelmann 1.289 txt += 'elif [ $middleware == ARC ]; then\n'
734     txt += self.wsSetupCMSLCGEnvironment_()
735    
736 mcinquil 1.340 #Setup PBS Environment
737 mcinquil 1.343 txt += 'elif [ $middleware == PBS ]; then\n'
738 mcinquil 1.340 txt += self.wsSetupCMSLCGEnvironment_()
739    
740 gutsche 1.3 txt += 'fi\n'
741 slacapra 1.1
742     # Prepare JobType-specific part
743     scram = self.scram.commandName()
744     txt += '\n\n'
745 fanzago 1.133 txt += 'echo ">>> specific cmssw setup environment:"\n'
746     txt += 'echo "CMSSW_VERSION = '+self.version+'"\n'
747 slacapra 1.1 txt += scram+' project CMSSW '+self.version+'\n'
748     txt += 'status=$?\n'
749     txt += 'if [ $status != 0 ] ; then\n'
750 fanzago 1.161 txt += ' echo "ERROR ==> CMSSW '+self.version+' not found on `hostname`" \n'
751     txt += ' job_exit_code=10034\n'
752 fanzago 1.163 txt += ' func_exit\n'
753 slacapra 1.1 txt += 'fi \n'
754     txt += 'cd '+self.version+'\n'
755 spiga 1.277 txt += 'SOFTWARE_DIR=`pwd`; export SOFTWARE_DIR\n'
756 fanzago 1.133 txt += 'echo ">>> current directory (SOFTWARE_DIR): $SOFTWARE_DIR" \n'
757 slacapra 1.1 txt += 'eval `'+scram+' runtime -sh | grep -v SCRAMRT_LSB_JOBNAME`\n'
758 fanzago 1.180 txt += 'if [ $? != 0 ] ; then\n'
759     txt += ' echo "ERROR ==> Problem with the command: "\n'
760     txt += ' echo "eval \`'+scram+' runtime -sh | grep -v SCRAMRT_LSB_JOBNAME \` at `hostname`"\n'
761     txt += ' job_exit_code=10034\n'
762     txt += ' func_exit\n'
763     txt += 'fi \n'
764 slacapra 1.1 # Handle the arguments:
765     txt += "\n"
766 farinafa 1.346 txt += "## number of arguments (first argument always jobnumber, the second is the resubmission number)\n"
767 slacapra 1.1 txt += "\n"
768 spiga 1.165 txt += "if [ $nargs -lt "+str(self.argsList)+" ]\n"
769 slacapra 1.1 txt += "then\n"
770 fanzago 1.161 txt += " echo 'ERROR ==> Too few arguments' +$nargs+ \n"
771     txt += ' job_exit_code=50113\n'
772     txt += " func_exit\n"
773 slacapra 1.1 txt += "fi\n"
774     txt += "\n"
775    
776     # Prepare job-specific part
777     job = common.job_list[nj]
778 ewv 1.131 if (self.datasetPath):
779 fanzago 1.93 txt += '\n'
780     txt += 'DatasetPath='+self.datasetPath+'\n'
781    
782 spiga 1.238 txt += 'PrimaryDataset='+self.primaryDataset +'\n'
783 fanzago 1.318 txt += 'DataTier='+self.dataTier+'\n'
784 fanzago 1.96 txt += 'ApplicationFamily=cmsRun\n'
785 fanzago 1.93
786     else:
787     txt += 'DatasetPath=MCDataTier\n'
788     txt += 'PrimaryDataset=null\n'
789     txt += 'DataTier=null\n'
790     txt += 'ApplicationFamily=MCDataTier\n'
791 ewv 1.170 if self.pset != None:
792 spiga 1.42 pset = os.path.basename(job.configFilename())
793 ewv 1.357 pkl = os.path.basename(job.configFilename()) + '.pkl'
794 spiga 1.42 txt += '\n'
795 spiga 1.95 txt += 'cp $RUNTIME_AREA/'+pset+' .\n'
796 ewv 1.357 txt += 'cp $RUNTIME_AREA/'+pkl+' .\n'
797 spiga 1.296
798 ewv 1.295 txt += 'PreserveSeeds=' + ','.join(self.preserveSeeds) + '; export PreserveSeeds\n'
799     txt += 'IncrementSeeds=' + ','.join(self.incrementSeeds) + '; export IncrementSeeds\n'
800     txt += 'echo "PreserveSeeds: <$PreserveSeeds>"\n'
801     txt += 'echo "IncrementSeeds:<$IncrementSeeds>"\n'
802 slacapra 1.90
803 ewv 1.184 txt += 'mv -f ' + pset + ' ' + psetName + '\n'
804 fanzago 1.360 if self.var_filter:
805     #print "self.var_filter = ",self.var_filter
806     txt += "export var_filter="+"'"+self.var_filter+"'\n"
807     txt += 'echo $var_filter'
808 ewv 1.319 else:
809 spiga 1.314 txt += '\n'
810 spiga 1.331 if self.AdditionalArgs: txt += 'export AdditionalArgs=\"%s\"\n'%(self.AdditionalArgs)
811 spiga 1.315 if int(self.NumEvents) != 0: txt += 'export MaxEvents=%s\n'%str(self.NumEvents)
812 gutsche 1.3 return txt
813 slacapra 1.176
814 fanzago 1.166 def wsUntarSoftware(self, nj=0):
815 gutsche 1.3 """
816     Put in the script the commands to build an executable
817     or a library.
818     """
819    
820 fanzago 1.166 txt = '\n#Written by cms_cmssw::wsUntarSoftware\n'
821 gutsche 1.3
822     if os.path.isfile(self.tgzNameWithPath):
823 belforte 1.393 txt += 'echo ">>> tar --no-same-permissions -xf $RUNTIME_AREA/'+os.path.basename(self.tgzNameWithPath)+' :" \n'
824     txt += 'tar --no-same-permissions -xf $RUNTIME_AREA/'+os.path.basename(self.tgzNameWithPath)+'\n'
825 fanzago 1.375 txt += 'untar_status=$? \n'
826 fanzago 1.285 if self.debug_wrapper==1 :
827 fanzago 1.375 txt += 'echo "----------------" \n'
828     txt += 'ls -AlR $RUNTIME_AREA \n'
829     txt += 'echo "----------------" \n'
830 gutsche 1.3 txt += 'if [ $untar_status -ne 0 ]; then \n'
831 fanzago 1.161 txt += ' echo "ERROR ==> Untarring .tgz file failed"\n'
832     txt += ' job_exit_code=$untar_status\n'
833     txt += ' func_exit\n'
834 gutsche 1.3 txt += 'else \n'
835     txt += ' echo "Successful untar" \n'
836     txt += 'fi \n'
837 gutsche 1.50 txt += '\n'
838 slacapra 1.211 txt += 'echo ">>> Include $RUNTIME_AREA in PYTHONPATH:"\n'
839 gutsche 1.50 txt += 'if [ -z "$PYTHONPATH" ]; then\n'
840 slacapra 1.211 txt += ' export PYTHONPATH=$RUNTIME_AREA/\n'
841 gutsche 1.50 txt += 'else\n'
842 slacapra 1.211 txt += ' export PYTHONPATH=$RUNTIME_AREA/:${PYTHONPATH}\n'
843 fanzago 1.93 txt += 'echo "PYTHONPATH=$PYTHONPATH"\n'
844 gutsche 1.50 txt += 'fi\n'
845     txt += '\n'
846    
847 gutsche 1.3 pass
848 ewv 1.131
849 belforte 1.396 # add the cpuLimi, wallLimit and rssLimit file for the watchdog
850     if self.cfg_params.get('GRID.max_rss'):
851     max_rss = int(self.cfg_params.get('GRID.max_rss')) * 1000
852     txt += 'echo "%d" > rssLimit\n' % max_rss
853     txt += 'maxrss=`cat rssLimit`\n'
854     txt += 'echo "RSS limit set to: ${maxrss} KBytes"\n'
855     if self.cfg_params.get('GRID.max_cpu_time'):
856     cpu_sec = int(self.cfg_params.get('GRID.max_cpu_time')) * 60
857     txt += 'echo "%d" > cpuLimit\n' % cpu_sec
858     txt += 'maxcpus=`cat cpuLimit`\n'
859     txt += 'maxcpuhms=`printf "%dh:%dm:%ds" $(($maxcpus/3600)) $(($maxcpus%3600/60)) $(($maxcpus%60))`\n'
860     txt += 'echo "Cpu Time limit set to: ${maxcpus} seconds '
861     txt += 'i.e. ${maxcpuhms}"\n'
862     if self.cfg_params.get('GRID.max_wall_clock_time'):
863     max_wall_sec = int(self.cfg_params.get('GRID.max_wall_clock_time')) * 60
864     txt += 'echo "%d" > wallLimit\n' % max_wall_sec
865     txt += 'maxwalls=`cat wallLimit`\n'
866     txt += 'maxwallhms=`printf "%dh:%dm:%ds" $(($maxwalls/3600)) $(($maxwalls%3600/60)) $(($maxwalls%60))`\n'
867     txt += 'echo "Wall Time limit set to: ${maxwalls} seconds '
868     txt += 'i.e. ${maxwallhms}"\n'
869 belforte 1.390
870 slacapra 1.1 return txt
871 ewv 1.170
872 fanzago 1.166 def wsBuildExe(self, nj=0):
873     """
874     Put in the script the commands to build an executable
875     or a library.
876     """
877    
878     txt = '\n#Written by cms_cmssw::wsBuildExe\n'
879     txt += 'echo ">>> moving CMSSW software directories in `pwd`" \n'
880 fanzago 1.375
881     txt += 'rm -rf lib/ module/ \n'
882 ewv 1.170 txt += 'mv $RUNTIME_AREA/lib/ . \n'
883     txt += 'mv $RUNTIME_AREA/module/ . \n'
884 spiga 1.374 if self.dataExist == True:
885 fanzago 1.375 txt += 'rm -rf src/ \n'
886 spiga 1.374 txt += 'mv $RUNTIME_AREA/src/ . \n'
887 ewv 1.182 if len(self.additional_inbox_files)>0:
888 belforte 1.394 #files used by Watchdog must not be moved
889     watchdogFiles=['rssLimit','vszLimit','diskLimit','cpuLimit','wallLimit']
890 spiga 1.179 for file in self.additional_inbox_files:
891 belforte 1.394 if file in watchdogFiles :
892     pass
893     else:
894     txt += 'mv $RUNTIME_AREA/'+os.path.basename(file)+' . \n'
895 ewv 1.170
896 slacapra 1.211 txt += 'echo ">>> Include $RUNTIME_AREA in PYTHONPATH:"\n'
897 fanzago 1.166 txt += 'if [ -z "$PYTHONPATH" ]; then\n'
898 slacapra 1.211 txt += ' export PYTHONPATH=$RUNTIME_AREA/\n'
899 fanzago 1.166 txt += 'else\n'
900 slacapra 1.211 txt += ' export PYTHONPATH=$RUNTIME_AREA/:${PYTHONPATH}\n'
901 fanzago 1.166 txt += 'echo "PYTHONPATH=$PYTHONPATH"\n'
902     txt += 'fi\n'
903     txt += '\n'
904    
905 slacapra 1.302 if self.pset != None:
906 ewv 1.334 psetName = 'pset.py'
907    
908 slacapra 1.302 txt += '\n'
909     if self.debug_wrapper == 1:
910     txt += 'echo "***** cat ' + psetName + ' *********"\n'
911     txt += 'cat ' + psetName + '\n'
912     txt += 'echo "****** end ' + psetName + ' ********"\n'
913     txt += '\n'
914     txt += 'echo "***********************" \n'
915     txt += 'which edmConfigHash \n'
916     txt += 'echo "***********************" \n'
917 ewv 1.334 txt += 'edmConfigHash ' + psetName + ' \n'
918     txt += 'PSETHASH=`edmConfigHash ' + psetName + '` \n'
919 slacapra 1.302 txt += 'echo "PSETHASH = $PSETHASH" \n'
920 belforte 1.399 #### temporary fix for noEdm files #####
921     txt += 'if [ -z "$PSETHASH" ]; then \n'
922     txt += ' export PSETHASH=null\n'
923     txt += 'fi \n'
924     #############################################
925     txt += '\n'
926 fanzago 1.166 return txt
927 slacapra 1.1
928 ewv 1.131
929 slacapra 1.1 def executableName(self):
930 ewv 1.192 if self.scriptExe:
931 spiga 1.42 return "sh "
932     else:
933     return self.executable
934 slacapra 1.1
935     def executableArgs(self):
936 ewv 1.276 if self.scriptExe:
937 spiga 1.370 return os.path.basename(self.scriptExe) + " $NJob $AdditionalArgs"
938 fanzago 1.115 else:
939 ewv 1.334 return " -j $RUNTIME_AREA/crab_fjr_$NJob.xml -p pset.py"
940 slacapra 1.1
941     def inputSandbox(self, nj):
942     """
943     Returns a list of filenames to be put in JDL input sandbox.
944     """
945     inp_box = []
946     if os.path.isfile(self.tgzNameWithPath):
947     inp_box.append(self.tgzNameWithPath)
948 spiga 1.320 if os.path.isfile(self.argsFile):
949     inp_box.append(self.argsFile)
950 spiga 1.243 inp_box.append(common.work_space.jobDir() + self.scriptName)
951 slacapra 1.1 return inp_box
952    
953     def outputSandbox(self, nj):
954     """
955     Returns a list of filenames to be put in JDL output sandbox.
956     """
957     out_box = []
958    
959     ## User Declared output files
960 slacapra 1.54 for out in (self.output_file+self.output_file_sandbox):
961 ewv 1.131 n_out = nj + 1
962 slacapra 1.207 out_box.append(numberFile(out,str(n_out)))
963 slacapra 1.1 return out_box
964    
965    
966     def wsRenameOutput(self, nj):
967     """
968     Returns part of a job script which renames the produced files.
969     """
970    
971 ewv 1.160 txt = '\n#Written by cms_cmssw::wsRenameOutput\n'
972 belforte 1.386 txt += 'echo ">>> current directory $PWD" \n'
973     txt += 'echo ">>> (SOFTWARE_DIR): $SOFTWARE_DIR" \n'
974     txt += 'echo ">>> (WORKING_DIR): $WORKING_DIR" \n'
975 fanzago 1.148 txt += 'echo ">>> current directory content:"\n'
976 fanzago 1.378 #if self.debug_wrapper==1:
977     txt += 'ls -Al\n'
978 fanzago 1.145 txt += '\n'
979 slacapra 1.54
980 fanzago 1.128 for fileWithSuffix in (self.output_file):
981 farinafa 1.346 output_file_num = numberFile(fileWithSuffix, '$OutUniqueID')
982 slacapra 1.1 txt += '\n'
983 gutsche 1.7 txt += '# check output file\n'
984 slacapra 1.106 txt += 'if [ -e ./'+fileWithSuffix+' ] ; then\n'
985 ewv 1.147 if (self.copy_data == 1): # For OSG nodes, file is in $WORKING_DIR, should not be moved to $RUNTIME_AREA
986     txt += ' mv '+fileWithSuffix+' '+output_file_num+'\n'
987 spiga 1.209 txt += ' ln -s `pwd`/'+output_file_num+' $RUNTIME_AREA/'+fileWithSuffix+'\n'
988 ewv 1.147 else:
989     txt += ' mv '+fileWithSuffix+' $RUNTIME_AREA/'+output_file_num+'\n'
990     txt += ' ln -s $RUNTIME_AREA/'+output_file_num+' $RUNTIME_AREA/'+fileWithSuffix+'\n'
991 slacapra 1.106 txt += 'else\n'
992 fanzago 1.161 txt += ' job_exit_code=60302\n'
993     txt += ' echo "WARNING: Output file '+fileWithSuffix+' not found"\n'
994 ewv 1.156 if common.scheduler.name().upper() == 'CONDOR_G':
995 gutsche 1.7 txt += ' if [ $middleware == OSG ]; then \n'
996     txt += ' echo "prepare dummy output file"\n'
997     txt += ' echo "Processing of job output failed" > $RUNTIME_AREA/'+output_file_num+'\n'
998     txt += ' fi \n'
999 slacapra 1.1 txt += 'fi\n'
1000 slacapra 1.105 file_list = []
1001     for fileWithSuffix in (self.output_file):
1002 farinafa 1.346 file_list.append(numberFile('$SOFTWARE_DIR/'+fileWithSuffix, '$OutUniqueID'))
1003 ewv 1.131
1004 spiga 1.245 txt += 'file_list="'+string.join(file_list,',')+'"\n'
1005 fanzago 1.149 txt += '\n'
1006 belforte 1.386 txt += 'echo ">>> current directory $PWD" \n'
1007     txt += 'echo ">>> (SOFTWARE_DIR): $SOFTWARE_DIR" \n'
1008     txt += 'echo ">>> (WORKING_DIR): $WORKING_DIR" \n'
1009 fanzago 1.148 txt += 'echo ">>> current directory content:"\n'
1010 fanzago 1.378 #if self.debug_wrapper==1:
1011     txt += 'ls -Al\n'
1012 fanzago 1.148 txt += '\n'
1013 gutsche 1.7 txt += 'cd $RUNTIME_AREA\n'
1014 fanzago 1.133 txt += 'echo ">>> current directory (RUNTIME_AREA): $RUNTIME_AREA"\n'
1015 slacapra 1.1 return txt
1016    
1017 slacapra 1.63 def getRequirements(self, nj=[]):
1018 slacapra 1.1 """
1019 ewv 1.131 return job requirements to add to jdl files
1020 slacapra 1.1 """
1021     req = ''
1022 slacapra 1.47 if self.version:
1023 slacapra 1.10 req='Member("VO-cms-' + \
1024 slacapra 1.47 self.version + \
1025 slacapra 1.10 '", other.GlueHostApplicationSoftwareRunTimeEnvironment)'
1026 ewv 1.192 if self.executable_arch:
1027 gutsche 1.107 req+=' && Member("VO-cms-' + \
1028 slacapra 1.105 self.executable_arch + \
1029     '", other.GlueHostApplicationSoftwareRunTimeEnvironment)'
1030 gutsche 1.35
1031     req = req + ' && (other.GlueHostNetworkAdapterOutboundIP)'
1032 spiga 1.353 if ( common.scheduler.name() in ["glite"] ):
1033 slacapra 1.316 ## 25-Jun-2009 SL: patch to use Cream enabled WMS
1034     if ( self.cfg_params.get('GRID.use_cream',None) ):
1035     req += ' && (other.GlueCEStateStatus == "Production" || other.GlueCEStateStatus == "Special")'
1036     else:
1037     req += ' && other.GlueCEStateStatus == "Production" '
1038 gutsche 1.35
1039 slacapra 1.1 return req
1040 gutsche 1.3
1041     def configFilename(self):
1042     """ return the config filename """
1043 ewv 1.334 return self.name()+'.py'
1044 gutsche 1.3
1045     def wsSetupCMSOSGEnvironment_(self):
1046     """
1047     Returns part of a job script which is prepares
1048     the execution environment and which is common for all CMS jobs.
1049     """
1050 ewv 1.160 txt = '\n#Written by cms_cmssw::wsSetupCMSOSGEnvironment_\n'
1051     txt += ' echo ">>> setup CMS OSG environment:"\n'
1052 fanzago 1.133 txt += ' echo "set SCRAM ARCH to ' + self.executable_arch + '"\n'
1053     txt += ' export SCRAM_ARCH='+self.executable_arch+'\n'
1054 fanzago 1.136 txt += ' echo "SCRAM_ARCH = $SCRAM_ARCH"\n'
1055 belforte 1.383 txt += ' echo "OSG_APP is $OSG_APP"\n'
1056 ewv 1.135 txt += ' if [ -f $OSG_APP/cmssoft/cms/cmsset_default.sh ] ;then\n'
1057 belforte 1.382 txt += ' cmsSetupFile=$OSG_APP/cmssoft/cms/cmsset_default.sh\n'
1058     txt += ' elif [ -f $CVMFS/cms.cern.ch/cmsset_default.sh ] ; then \n'
1059     txt += ' cmsSetupFile=$CVMFS/cms.cern.ch/cmsset_default.sh\n'
1060     txt += ' elif [ -f /cvmfs/cms.cern.ch/cmsset_default.sh ] ; then \n'
1061     txt += ' cmsSetupFile=/cvmfs/cms.cern.ch/cmsset_default.sh\n'
1062 fanzago 1.133 txt += ' else\n'
1063 belforte 1.383 txt += ' echo "CVMSF = $CVMFS"\n'
1064     txt += ' echo "/cvmfs/ is"\n'
1065     txt += ' echo "ls /"\n'
1066     txt += ' ls /\n'
1067     txt += ' echo "ls /cvmfs"\n'
1068     txt += ' ls /cvmfs\n'
1069     txt += ' echo "ls /cvmfs/cms.cern.ch"\n'
1070     txt += ' ls /cvmfs/cms.cern.ch\n'
1071     txt += ' ls /cvmfs/cms.cern.ch/cmsset*\n'
1072     txt += ' ls /cvmfs/cms.cern.ch/cmsset_default.sh\n'
1073 belforte 1.382 txt += ' echo "ERROR ==> cmsset_default.sh file not found"\n'
1074 fanzago 1.161 txt += ' job_exit_code=10020\n'
1075     txt += ' func_exit\n'
1076 fanzago 1.133 txt += ' fi\n'
1077 gutsche 1.3 txt += '\n'
1078 belforte 1.382 txt += ' echo "sourcing $cmsSetupFile ..."\n'
1079     txt += ' source $cmsSetupFile\n'
1080     txt += ' result=$?\n'
1081     txt += ' if [ $result -ne 0 ]; then\n'
1082     txt += ' echo "ERROR ==> problem sourcing $cmsSetupFile"\n'
1083     txt += ' job_exit_code=10032\n'
1084     txt += ' func_exit\n'
1085     txt += ' else\n'
1086     txt += ' echo "==> setup cms environment ok"\n'
1087     txt += ' echo "SCRAM_ARCH = $SCRAM_ARCH"\n'
1088     txt += ' fi\n'
1089 gutsche 1.3
1090     return txt
1091 ewv 1.131
1092 gutsche 1.3 def wsSetupCMSLCGEnvironment_(self):
1093     """
1094     Returns part of a job script which is prepares
1095     the execution environment and which is common for all CMS jobs.
1096     """
1097 ewv 1.160 txt = '\n#Written by cms_cmssw::wsSetupCMSLCGEnvironment_\n'
1098     txt += ' echo ">>> setup CMS LCG environment:"\n'
1099 fanzago 1.133 txt += ' echo "set SCRAM ARCH and BUILD_ARCH to ' + self.executable_arch + ' ###"\n'
1100     txt += ' export SCRAM_ARCH='+self.executable_arch+'\n'
1101     txt += ' export BUILD_ARCH='+self.executable_arch+'\n'
1102     txt += ' if [ ! $VO_CMS_SW_DIR ] ;then\n'
1103 fanzago 1.161 txt += ' echo "ERROR ==> CMS software dir not found on WN `hostname`"\n'
1104     txt += ' job_exit_code=10031\n'
1105     txt += ' func_exit\n'
1106 fanzago 1.133 txt += ' else\n'
1107     txt += ' echo "Sourcing environment... "\n'
1108     txt += ' if [ ! -s $VO_CMS_SW_DIR/cmsset_default.sh ] ;then\n'
1109 fanzago 1.161 txt += ' echo "ERROR ==> cmsset_default.sh file not found into dir $VO_CMS_SW_DIR"\n'
1110     txt += ' job_exit_code=10020\n'
1111     txt += ' func_exit\n'
1112 fanzago 1.133 txt += ' fi\n'
1113     txt += ' echo "sourcing $VO_CMS_SW_DIR/cmsset_default.sh"\n'
1114     txt += ' source $VO_CMS_SW_DIR/cmsset_default.sh\n'
1115     txt += ' result=$?\n'
1116     txt += ' if [ $result -ne 0 ]; then\n'
1117 fanzago 1.161 txt += ' echo "ERROR ==> problem sourcing $VO_CMS_SW_DIR/cmsset_default.sh"\n'
1118     txt += ' job_exit_code=10032\n'
1119     txt += ' func_exit\n'
1120 fanzago 1.133 txt += ' fi\n'
1121     txt += ' fi\n'
1122     txt += ' \n'
1123 fanzago 1.161 txt += ' echo "==> setup cms environment ok"\n'
1124 gutsche 1.3 return txt
1125 gutsche 1.5
1126 spiga 1.238 def wsModifyReport(self, nj):
1127 fanzago 1.93 """
1128 ewv 1.131 insert the part of the script that modifies the FrameworkJob Report
1129 fanzago 1.93 """
1130 ewv 1.250
1131 fanzago 1.281 txt = ''
1132 fanzago 1.292 if (self.copy_data == 1):
1133 fanzago 1.281 txt = '\n#Written by cms_cmssw::wsModifyReport\n'
1134 ewv 1.283
1135 fanzago 1.175 txt += 'echo ">>> Modify Job Report:" \n'
1136 fanzago 1.217 txt += 'chmod a+x $RUNTIME_AREA/ProdCommon/FwkJobRep/ModifyJobReport.py\n'
1137 fanzago 1.175 txt += 'echo "CMSSW_VERSION = $CMSSW_VERSION"\n\n'
1138 fanzago 1.344
1139 fanzago 1.360 args = 'fjr $RUNTIME_AREA/crab_fjr_$NJob.xml json $RUNTIME_AREA/resultCopyFile n_job $OutUniqueID PrimaryDataset $PrimaryDataset ApplicationFamily $ApplicationFamily ApplicationName $executable cmssw_version $CMSSW_VERSION psethash $PSETHASH'
1140 fanzago 1.281
1141 fanzago 1.318 if (self.publish_data == 1):
1142     txt += 'ProcessedDataset='+self.processedDataset+'\n'
1143 fanzago 1.292 txt += 'echo "ProcessedDataset = $ProcessedDataset"\n'
1144     args += ' UserProcessedDataset $USER-$ProcessedDataset-$PSETHASH'
1145 fanzago 1.281
1146 fanzago 1.247 txt += 'echo "$RUNTIME_AREA/ProdCommon/FwkJobRep/ModifyJobReport.py '+str(args)+'"\n'
1147     txt += '$RUNTIME_AREA/ProdCommon/FwkJobRep/ModifyJobReport.py '+str(args)+'\n'
1148 fanzago 1.175 txt += 'modifyReport_result=$?\n'
1149     txt += 'if [ $modifyReport_result -ne 0 ]; then\n'
1150     txt += ' modifyReport_result=70500\n'
1151     txt += ' job_exit_code=$modifyReport_result\n'
1152     txt += ' echo "ModifyReportResult=$modifyReport_result" | tee -a $RUNTIME_AREA/$repo\n'
1153     txt += ' echo "WARNING: Problem with ModifyJobReport"\n'
1154     txt += 'else\n'
1155     txt += ' mv NewFrameworkJobReport.xml $RUNTIME_AREA/crab_fjr_$NJob.xml\n'
1156 spiga 1.103 txt += 'fi\n'
1157 fanzago 1.93 return txt
1158 ewv 1.283
1159 ewv 1.192 def wsParseFJR(self):
1160 spiga 1.189 """
1161 ewv 1.192 Parse the FrameworkJobReport to obtain useful infos
1162 spiga 1.189 """
1163     txt = '\n#Written by cms_cmssw::wsParseFJR\n'
1164     txt += 'echo ">>> Parse FrameworkJobReport crab_fjr.xml"\n'
1165     txt += 'if [ -s $RUNTIME_AREA/crab_fjr_$NJob.xml ]; then\n'
1166     txt += ' if [ -s $RUNTIME_AREA/parseCrabFjr.py ]; then\n'
1167 spiga 1.197 txt += ' cmd_out=`python $RUNTIME_AREA/parseCrabFjr.py --input $RUNTIME_AREA/crab_fjr_$NJob.xml --dashboard $MonitorID,$MonitorJobID '+self.debugWrap+'`\n'
1168 fanzago 1.285 if self.debug_wrapper==1 :
1169 spiga 1.197 txt += ' echo "Result of parsing the FrameworkJobReport crab_fjr.xml: $cmd_out"\n'
1170 spiga 1.371 txt += ' cmd_out_1=`python $RUNTIME_AREA/parseCrabFjr.py --input $RUNTIME_AREA/crab_fjr_$NJob.xml --popularity $MonitorID,$MonitorJobID,$RUNTIME_AREA/inputsReport.txt '+self.debugWrap+'`\n'
1171 spiga 1.372 # if self.debug_wrapper==1 :
1172     txt += ' echo "Result of parsing the FrameworkJobReport crab_fjr.xml: $cmd_out_1"\n'
1173 spiga 1.197 txt += ' executable_exit_status=`python $RUNTIME_AREA/parseCrabFjr.py --input $RUNTIME_AREA/crab_fjr_$NJob.xml --exitcode`\n'
1174 spiga 1.189 txt += ' if [ $executable_exit_status -eq 50115 ];then\n'
1175     txt += ' echo ">>> crab_fjr.xml contents: "\n'
1176 spiga 1.222 txt += ' cat $RUNTIME_AREA/crab_fjr_$NJob.xml\n'
1177 spiga 1.189 txt += ' echo "Wrong FrameworkJobReport --> does not contain useful info. ExitStatus: $executable_exit_status"\n'
1178 spiga 1.197 txt += ' elif [ $executable_exit_status -eq -999 ];then\n'
1179     txt += ' echo "ExitStatus from FrameworkJobReport not available. not available. Using exit code of executable from command line."\n'
1180 spiga 1.189 txt += ' else\n'
1181     txt += ' echo "Extracted ExitStatus from FrameworkJobReport parsing output: $executable_exit_status"\n'
1182     txt += ' fi\n'
1183     txt += ' else\n'
1184     txt += ' echo "CRAB python script to parse CRAB FrameworkJobReport crab_fjr.xml is not available, using exit code of executable from command line."\n'
1185     txt += ' fi\n'
1186     #### Patch to check input data reading for CMSSW16x Hopefully we-ll remove it asap
1187 spiga 1.232 txt += ' if [ $executable_exit_status -eq 0 ];then\n'
1188 fanzago 1.273 txt += ' echo ">>> Executable succeded $executable_exit_status"\n'
1189 spiga 1.232 txt += ' fi\n'
1190 spiga 1.189 txt += 'else\n'
1191     txt += ' echo "CRAB FrameworkJobReport crab_fjr.xml is not available, using exit code of executable from command line."\n'
1192     txt += 'fi\n'
1193     txt += '\n'
1194 fanzago 1.364 txt += 'if [ $executable_exit_status -ne 0 ];then\n'
1195 fanzago 1.273 txt += ' echo ">>> Executable failed $executable_exit_status"\n'
1196     txt += ' echo "ExeExitCode=$executable_exit_status" | tee -a $RUNTIME_AREA/$repo\n'
1197     txt += ' echo "EXECUTABLE_EXIT_STATUS = $executable_exit_status"\n'
1198     txt += ' job_exit_code=$executable_exit_status\n'
1199     txt += ' func_exit\n'
1200     txt += 'fi\n\n'
1201 spiga 1.189 txt += 'echo "ExeExitCode=$executable_exit_status" | tee -a $RUNTIME_AREA/$repo\n'
1202     txt += 'echo "EXECUTABLE_EXIT_STATUS = $executable_exit_status"\n'
1203     txt += 'job_exit_code=$executable_exit_status\n'
1204    
1205     return txt
1206    
1207 gutsche 1.5 def setParam_(self, param, value):
1208     self._params[param] = value
1209    
1210     def getParams(self):
1211     return self._params
1212 gutsche 1.8
1213 spiga 1.257 def outList(self,list=False):
1214 mcinquil 1.121 """
1215     check the dimension of the output files
1216     """
1217 spiga 1.169 txt = ''
1218     txt += 'echo ">>> list of expected files on output sandbox"\n'
1219 mcinquil 1.121 listOutFiles = []
1220 ewv 1.170 stdout = 'CMSSW_$NJob.stdout'
1221 spiga 1.169 stderr = 'CMSSW_$NJob.stderr'
1222 spiga 1.268 if len(self.output_file) <= 0:
1223     msg ="WARNING: no output files name have been defined!!\n"
1224     msg+="\tno output files will be reported back/staged\n"
1225 spiga 1.304 common.logger.info(msg)
1226 ewv 1.350
1227 fanzago 1.148 if (self.return_data == 1):
1228 farinafa 1.348 for file in (self.output_file):
1229     listOutFiles.append(numberFile(file, '$OutUniqueID'))
1230     for file in (self.output_file_sandbox):
1231     listOutFiles.append(numberFile(file, '$NJob'))
1232     listOutFiles.append(stdout)
1233     listOutFiles.append(stderr)
1234 belforte 1.384 listOutFiles.append('Watchdog_$NJob.log.gz')
1235 farinafa 1.348
1236 fanzago 1.161 txt += 'echo "output files: '+string.join(listOutFiles,' ')+'"\n'
1237 spiga 1.157 txt += 'filesToCheck="'+string.join(listOutFiles,' ')+'"\n'
1238 spiga 1.169 txt += 'export filesToCheck\n'
1239 spiga 1.341 taskinfo={}
1240     taskinfo['outfileBasename'] = self.output_file
1241     common._db.updateTask_(taskinfo)
1242 ewv 1.276
1243 spiga 1.257 if list : return self.output_file
1244 ewv 1.170 return txt
1245 ewv 1.355
1246 fanzago 1.369 def checkCMSSWVersion(self, url = "https://cmstags.cern.ch/tc/", fileName = "ReleasesXML"):
1247 ewv 1.355 """
1248     compare current CMSSW release and arch with allowed releases
1249     """
1250    
1251     downloader = Downloader(url)
1252     goodRelease = False
1253 ewv 1.367 tagCollectorUrl = url + fileName
1254 ewv 1.355
1255     try:
1256     result = downloader.config(fileName)
1257     except:
1258     common.logger.info("ERROR: Problem reading file of allowed CMSSW releases.")
1259    
1260     try:
1261     events = pulldom.parseString(result)
1262    
1263     arch = None
1264     release = None
1265     relState = None
1266     for (event, node) in events:
1267     if event == pulldom.START_ELEMENT:
1268     if node.tagName == 'architecture':
1269     arch = node.attributes.getNamedItem('name').nodeValue
1270     if node.tagName == 'project':
1271     relState = node.attributes.getNamedItem('state').nodeValue
1272 ewv 1.367 if relState == 'Announced':
1273 ewv 1.355 release = node.attributes.getNamedItem('label').nodeValue
1274     if self.executable_arch == arch and self.version == release:
1275     goodRelease = True
1276     return goodRelease
1277    
1278     if not goodRelease:
1279 ewv 1.367 msg = "WARNING: %s on %s is not among supported releases listed at %s ." % \
1280     (self.version, self.executable_arch, tagCollectorUrl)
1281 ewv 1.355 msg += "Submission may fail."
1282     common.logger.info(msg)
1283     except:
1284     common.logger.info("Problems parsing file of allowed CMSSW releases.")
1285    
1286     return goodRelease
1287