ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/writeCfg.py
(Generate patch)

Comparing COMP/CRAB/python/writeCfg.py (file contents):
Revision 1.27 by ewv, Mon Apr 5 16:47:36 2010 UTC vs.
Revision 1.33 by spiga, Wed Mar 23 16:48:53 2011 UTC

# Line 17 | Line 17 | import xml.dom.minidom
17   from random import SystemRandom
18  
19   from ProdCommon.CMSConfigTools.ConfigAPI.CfgInterface import CfgInterface
20 from FWCore.ParameterSet.Config                       import include
20   import FWCore.ParameterSet.Types as CfgTypes
21  
22   MyRandom  = SystemRandom()
# Line 121 | Line 120 | def main(argv) :
120                  firstLumi = int(elem.getAttribute("FirstLumi"))
121  
122              generator      = str(elem.getAttribute('Generator'))
123 +            inputBlocks    = str(elem.getAttribute('InputBlocks'))
124              inputFiles     = str(elem.getAttribute('InputFiles'))
125              parentFiles    = str(elem.getAttribute('ParentFiles'))
126              lumis          = str(elem.getAttribute('Lumis'))
127  
128 +    report(inputBlocks,inputFiles,parentFiles,lumis)
129 +
130    # Read Input python config file
131  
132      handle = open(fileName, 'r')
# Line 147 | Line 149 | def main(argv) :
149      if maxEvents:
150          cfg.maxEvents.setMaxEventsInput(maxEvents)
151  
152 <    if skipEvents:
152 >    if skipEvents and inModule.sourceType not in ['EmptySource']:
153          inModule.setSkipEvents(skipEvents)
154  
155      # Set "skip events" for various generators
# Line 186 | Line 188 | def main(argv) :
188          print "RandomNumberGeneratorService found, will attempt to change seeds"
189          from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper
190          ranGenerator = cfg.data.services['RandomNumberGeneratorService']
191 +
192 +        ranModules   = getattr(ranGenerator, "moduleSeeds", None)
193 +        oldSource    = getattr(ranGenerator, "sourceSeed",  None)
194 +        if ranModules != None or oldSource != None:
195 +            msg = "Your random number seeds are set in an old,\n"
196 +            msg += "deprecated style. Please change to new style:\n"
197 +            msg += "https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideEDMRandomNumberGeneratorService"
198 +            raise ConfigException(msg)
199 +
200          randSvc = RandomNumberServiceHelper(ranGenerator)
201  
202          incrementSeedList = []
# Line 225 | Line 236 | def main(argv) :
236          print cmsProcess.dumpPython()
237  
238  
239 + def report( inputBlocks='', inputFiles='', parentFiles='', lumis='' ):
240 +    """
241 +    Writes the 4 parameters to a file, one parameter per line.
242 +    """
243 +    outFile = open('%s/inputsReport.txt'%os.environ['RUNTIME_AREA'],"a")
244 +
245 +  #  InputFileList=inputFiles.split(',')
246 +  #  parentFilesList= parentFiles.split(',')
247 +  #  lumisList= lumis.split(',')
248 +
249 +    ## replacing , with ; otherwise report.py will split it as a new parameter
250 +    txt = ''
251 +    txt += 'inputBlocks='+inputBlocks.replace(',',';')+'\n'
252 +    txt += 'inputFiles='+inputFiles.replace(',',';')+'\n'
253 +    txt += 'parentFiles='+parentFiles.replace(',',';')+'\n'
254 +    txt += 'lumisRange='+lumis.replace(',',';')+'\n'
255 +    outFile.write(str(txt))
256 +    outFile.close()
257 +    return
258 +
259 +
260   if __name__ == '__main__' :
261      exit_status = main(sys.argv[1:])
262      sys.exit(exit_status)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines