def checkcreateWorkflow(cfgFile): """ """ try: # // # // Set CMSSW_SEARCH_PATH #// pwd = getenv ("PWD") oldCmsswSearchPath = getenv ("CMSSW_SEARCH_PATH") if not oldCmsswSearchPath: msg = "CMSSW_SEARCH_PATH not set....you need to set CMSSW environment " raise RuntimeError, msg #os.environ["CMSSW_SEARCH_PATH"] = "%s:%s" % (pwd, oldCmsswSearchPath) os.environ["CMSSW_SEARCH_PATH"] = "/:%s" % (oldCmsswSearchPath) # // # // convert cfg #// # for the time being we support only cfg file. We might have to support multiple types soon print ">>> Checking cfg %s"%cfgFile if cfgType == "cfg": from FWCore.ParameterSet.Config import include cmsCfg = include(cfgFile) else: modRef = imp.find_module( os.path.basename(cfgFile).replace(".py", ""), os.path.dirname(cfgFile)) cmsCfg = modRef.process cfgWrapper = CMSSWConfig() cfgWrapper.originalCfg = file(cfgFile).read() cfgInt = cfgWrapper.loadConfiguration(cmsCfg) cfgInt.validateForProduction() except Exception, e: print "Unable to create request: %s" % e
def IncludePset(self): """ """ from FWCore.ParameterSet.Config import include common.logger.info('Starting include.....') try: cfo = include(self.pset) except Exception, ex: msg = "Python parsing failed: \n\n%s" % \ str(traceback.format_exc()) msg += "\n\nPlease post on the EDM hypernews if this " + \ "information doesn't help solve this problem." raise CrabException(msg)
def IncludePset(self): """ """ from FWCore.ParameterSet.Config import include common.logger.info( 'Starting include.....' ) try: cfo = include(self.pset) except Exception, ex: msg = "Python parsing failed: \n\n%s" % \ str(traceback.format_exc()) msg += "\n\nPlease post on the EDM hypernews if this " + \ "information doesn't help solve this problem." raise CrabException(msg)
maker = CmsGenWorkflowMaker(requestId, channel, label) maker.setPhysicsGroup(physicsGroup) # set cmssw version to same as first cmsRun maker.setCmsGenCMSSWVersion(versions[0]) maker.setCmsGenConfiguration(file(cmsGenCfg).read()) maker.setCmsGenParameters(generator = generatorString[0]) maker.changeCategory(category) # loop over cfg's provided and add to workflow # first cmsRun node created implicitly by WorkflowMaker nodeNumber = 0 for cmsRunCfg in cmsRunCfgs: if cfgTypes[nodeNumber] == "cfg": from FWCore.ParameterSet.Config import include cmsCfg = include(cmsRunCfg) else: import imp modRef = imp.load_source( os.path.basename(cmsRunCfg).replace(".py", ""), cmsRunCfg) cmsCfg = modRef.process cfgWrapper = CMSSWConfig() #cfgWrapper.originalCfg = file(cmsRunCfg).read() cfgInt = cfgWrapper.loadConfiguration(cmsCfg) cfgInt.validateForProduction() if nodeNumber: try: inputModules = chainedInputs[nodeNumber-1] except IndexError: inputModules = []
#// maker = WorkflowMaker(requestId, channel, label ) maker.setPhysicsGroup(physicsGroup) maker.changeCategory(category) if selectionEfficiency != None: maker.addSelectionEfficiency(selectionEfficiency) # loop over cfg's provided and add to workflow # first cmsRun node created implicitly by WorkflowMaker nodeNumber = 0 for cfgFile in cfgFiles: if cfgTypes[nodeNumber] == "cfg": from FWCore.ParameterSet.Config import include cmsCfg = include(cfgFile) else: import imp modRef = imp.load_source( os.path.basename(cfgFile).replace(".py", ""), cfgFile) cmsCfg = modRef.process cfgWrapper = CMSSWConfig() cfgInt = cfgWrapper.loadConfiguration(cmsCfg) cfgInt.validateForProduction() if nodeNumber: try: inputModules = chainedInputs[nodeNumber-1] except IndexError: inputModules = [] maker.chainCmsRunNode(stageoutOutputs[nodeNumber-1], *inputModules)
""" import sys import os import getopt from string import * from FWCore.ParameterSet.Types import * import pdb #import Spring08_Zmumu_10TeV_cfi as process from FWCore.ParameterSet.Config import include cfgfile=sys.argv[1] process = include(cfgfile) from FWCore.ParameterSet.Mixins import _SimpleParameterTypeBase, _ParameterTypeBase def indexDict(modName, modRef): """ _indexDict_ Given a PSet like python dictionary, generate an index file from it. If it has PSet children, act on them recursively """ result = []
#!/usr/bin/env python cfgFile = "Configuration/Spring08Production/data/Spring08_Gamma_Jets_PythiaFilterGammaGamma_GEN.cfg" from FWCore.ParameterSet.Config import include process = include(cfgFile)