CMS 3D CMS Logo

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__ (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

Runs edmConfigDump to produce an expanded cfg file

Definition at line 473 of file production_tasks.py.

Constructor & Destructor Documentation

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

Definition at line 476 of file production_tasks.py.

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

Member Function Documentation

def production_tasks.ExpandConfig.run (   self,
  input 
)

Definition at line 478 of file production_tasks.py.

References FrontierConditions_GlobalTag_cff.file.

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