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.RunTestEvents Class Reference
Inheritance diagram for production_tasks.RunTestEvents:
production_tasks.Task

Public Member Functions

def __init__
 
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

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

Definition at line 429 of file production_tasks.py.

Constructor & Destructor Documentation

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

Definition at line 432 of file production_tasks.py.

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

Member Function Documentation

def production_tasks.RunTestEvents.run (   self,
  input 
)

Definition at line 434 of file production_tasks.py.

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

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