CMS 3D CMS Logo

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

Public Member Functions

def __init__ (self, dataset, user, options)
 
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

Run cmsRun but with a small number of events on the job CFG.

Definition at line 433 of file production_tasks.py.

Constructor & Destructor Documentation

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

Definition at line 436 of file production_tasks.py.

436  def __init__(self, dataset, user, options):
437  Task.__init__(self,'RunTestEvents', dataset, user, options)
def __init__(self, dataset, user, options)

Member Function Documentation

def production_tasks.RunTestEvents.run (   self,
  input 
)

Definition at line 438 of file production_tasks.py.

References FrontierConditions_GlobalTag_cff.file, and production_tasks.insertLines().

438  def run(self, input):
439 
440  full = input['FullCFG']['FullCFG']
441  jobdir = input['CreateJobDirectory']['JobDir']
442 
443  config = file(full).readlines()
444  source = os.path.join(jobdir,'test_cfg.py')
445  output = file(source,'w')
446  toInsert = ['\n',
447  'process.maxEvents.input = cms.untracked.int32(5)\n',
448  'if hasattr(process,"source"): process.source.fileNames = process.source.fileNames[:10]\n'
449  ]
450  config = insertLines( config, toInsert )
451  output.writelines(config)
452  output.close()
453 
454  pwd = os.getcwd()
455 
456  error = None
457  try:
458  os.chdir(jobdir)
459 
460  child = subprocess.Popen(['cmsRun',os.path.basename(source)], stdout=subprocess.PIPE,stderr=subprocess.PIPE)
461  stdout, stderr = child.communicate()
462 
463  if child.returncode != 0:
464  error = "Failed to cmsRun with a few events. Error was '%s' (%i)." % (stderr,child.returncode)
465  finally:
466  os.chdir(pwd)
467 
468  if error is not None:
469  raise Exception(error)
470 
471  return {'Status':'VALID','TestCFG':source}
def insertLines(insertedTo, toInsert)