ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/cms_cmssw.py
Revision: 1.396
Committed: Tue Apr 2 13:53:44 2013 UTC (12 years ago) by belforte
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_9_0_pre1, CRAB_2_8_8, CRAB_2_8_8_pre1, CRAB_2_8_7_patch3, CRAB_2_8_7_patch2, CRAB_2_8_7_patch1, CRAB_2_8_7, CRAB_2_8_7_pre2, CRAB_2_8_7_pre1
Changes since 1.395: +22 -16 lines
Log Message:
max_wall_clock_time shoudl work for any scheduler https://savannah.cern.ch/bugs/index.php?101064

File Contents

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