CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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__
 
def addOption
 
def run
 
- Public Member Functions inherited from production_tasks.Task
def __init__
 
def addOption
 
def getname
 
def run
 

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 378 of file production_tasks.py.

Constructor & Destructor Documentation

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

Definition at line 380 of file production_tasks.py.

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

Member Function Documentation

def production_tasks.FullCFG.addOption (   self,
  parser 
)

Definition at line 382 of file production_tasks.py.

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

Definition at line 385 of file production_tasks.py.

References CalibratedPatElectronProducer.dataset, production_tasks.Task.dataset, CalibratedElectronProducer.dataset, edmIntegrityCheck.IntegrityCheck.dataset, genericValidation.GenericValidationData.dataset, mergeVDriftHistosByStation.file, production_tasks.insertLines(), dataset.BaseDataset.user, EcalTPGParamReaderFromDB.user, production_tasks.Task.user, popcon::RPCObPVSSmapData.user, popcon::RpcDataT.user, popcon::RpcDataV.user, popcon::RpcObGasData.user, popcon::RpcDataFebmap.user, popcon::RpcDataGasMix.user, popcon::RpcDataUXC.user, popcon::RpcDataS.user, popcon::RpcDataI.user, MatrixInjector.MatrixInjector.user, EcalDBConnection.user, and conddblib.TimeType.user.

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