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

Runs edmConfigDump to produce an expanded cfg file

Definition at line 469 of file production_tasks.py.

Constructor & Destructor Documentation

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

Definition at line 472 of file production_tasks.py.

473  def __init__(self, dataset, user, options):
Task.__init__(self,'ExpandConfig', dataset, user, options)

Member Function Documentation

def production_tasks.ExpandConfig.run (   self,
  input 
)

Definition at line 474 of file production_tasks.py.

References mergeVDriftHistosByStation.file, and SiPixelLorentzAngle_cfi.read.

475  def run(self, input):
476 
477  full = input['FullCFG']['FullCFG']
478  jobdir = input['CreateJobDirectory']['JobDir']
479 
480  config = file(full).read()
481  source = os.path.join(jobdir,'test_cfg.py')
482  expanded = 'Expanded%s' % os.path.basename(full)
483  output = file(source,'w')
484  output.write(config)
485  output.write("file('%s','w').write(process.dumpPython())\n" % expanded)
486  output.close()
487 
488  pwd = os.getcwd()
489 
490  result = {}
491  error = None
492  try:
493  os.chdir(jobdir)
494 
495  child = subprocess.Popen(['python',os.path.basename(source)], stdout=subprocess.PIPE,stderr=subprocess.PIPE)
496  stdout, stderr = child.communicate()
497 
498  if child.returncode != 0:
499  error = "Failed to edmConfigDump. Error was '%s' (%i)." % (stderr,child.returncode)
500  result['ExpandedFullCFG'] = os.path.join(jobdir,expanded)
501 
502  finally:
503  os.chdir(pwd)
504 
505  if error is not None:
506  raise Exception(error)
507 
return result