CMS 3D CMS Logo

List of all members | Public Member Functions
production_tasks.FullCFG Class Reference
Inheritance diagram for production_tasks.FullCFG:
production_tasks.Task

Public Member Functions

def __init__ (self, dataset, user, options)
 
def addOption (self, parser)
 
def run (self, input)
 
- Public Member Functions inherited from production_tasks.Task
def __init__ (self, name, dataset, user, options, instance=None)
 
def addOption (self, parser)
 
def getname (self)
 
def run (self, input)
 

Additional Inherited Members

- Public Attributes inherited from production_tasks.Task
 dataset
 
 instance
 
 name
 
 options
 
 user
 

Detailed Description

Generate the full CFG needed to run the job and writes it to the job directory

Definition at line 382 of file production_tasks.py.

Constructor & Destructor Documentation

def production_tasks.FullCFG.__init__ (   self,
  dataset,
  user,
  options 
)

Definition at line 384 of file production_tasks.py.

384  def __init__(self, dataset, user, options):
385  Task.__init__(self,'FullCFG', dataset, user, options)
def __init__(self, dataset, user, options)

Member Function Documentation

def production_tasks.FullCFG.addOption (   self,
  parser 
)

Definition at line 386 of file production_tasks.py.

386  def addOption(self, parser):
387  parser.add_option("--cfg", dest="cfg", default=None, help='The top level CFG to run')
388  parser.add_option("--nEventsPerJob", dest="nEventsPerJob", default=None, help='Number of events per job (for testing)')
def addOption(self, parser)
def production_tasks.FullCFG.run (   self,
  input 
)

Definition at line 389 of file production_tasks.py.

References production_tasks.Task.dataset, edmIntegrityCheck.IntegrityCheck.dataset, genericValidation.GenericValidationData.dataset, FrontierConditions_GlobalTag_cff.file, production_tasks.insertLines(), createfilelist.int, EcalTPGParamReaderFromDB.user, dataset.BaseDataset.user, production_tasks.Task.user, popcon::RpcDataT.user, popcon::RpcObGasData.user, popcon::RpcDataV.user, popcon::RPCObPVSSmapData.user, popcon::RpcDataI.user, popcon::RpcDataFebmap.user, popcon::RpcDataUXC.user, popcon::RpcDataS.user, popcon::RpcDataGasMix.user, MatrixInjector.MatrixInjector.user, and EcalDBConnection.user.

389  def run(self, input):
390 
391  jobdir = input['CreateJobDirectory']['JobDir']
392 
393  if self.options.cfg is None or not os.path.exists(self.options.cfg):
394  raise Exception("The file '%s' does not exist. Please check." % self.options.cfg)
395 
396  config = file(self.options.cfg).readlines()
397  sourceFile = os.path.basename(input['SourceCFG']['SourceCFG'])
398  if sourceFile.lower().endswith('.py'):
399  sourceFile = sourceFile[:-3]
400 
401  source = os.path.join(jobdir,'full_cfg.py')
402  output = file(source,'w')
403 
404  nEventsPerJob = -1
405  if self.options.nEventsPerJob:
406  nEventsPerJob = int(self.options.nEventsPerJob)
407 
408  toInsert = ['\nfrom %s import *\n' % sourceFile,
409  'process.source.fileNames = files\n',
410  'if hasattr(process,"maxEvents"): process.maxEvents.input = cms.untracked.int32({nEvents})\n'.format(nEvents=nEventsPerJob),
411  'if hasattr(process,"maxLuminosityBlocks"): process.maxLuminosityBlocks.input = cms.untracked.int32(-1)\n'
412  'datasetInfo = ("%s","%s","%s")\n' % (self.user, self.dataset, fnmatch.translate(self.options.wildcard) )
413  ]
414  config = insertLines( config, toInsert )
415  output.writelines(config)
416  output.close()
417  return {'FullCFG':source}
418 
def insertLines(insertedTo, toInsert)