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
logging.debug("Lazy downloads ENABLED.") cmsCfg.AdaptorConfig = cms.Service("AdaptorConfig", cacheHint = cms.untracked.string("lazy-download"), readHint = cms.untracked.string("auto-detect")) else: logging.debug("Lazy downloads DISABLED.") cmsCfg.AdaptorConfig = cms.Service("AdaptorConfig", cacheHint = cms.untracked.string("application-only"), readHint = cms.untracked.string("direct-unbuffered")) for outputModuleName in cmsCfg.outputModules: outputModule = getattr(cmsCfg, outputModuleName) outputModule.fastCloning = cms.untracked.bool(False) cfgWrapper = CMSSWConfig() cfgWrapper.originalCfg = file(self.configFile).read() cfgInt = cfgWrapper.loadConfiguration(cmsCfg) cfgInt.validateForProduction() self.workflow.payload.cfgInterface = cfgWrapper for outputModuleName in cmsCfg.outputModules: outputModule = getattr(cmsCfg, outputModuleName) self.setupOutputModule(outputModuleName, outputModule.dataset.dataTier.value()) loader.unload() return def loadProcessFromFramework(self): """
# // cfg python parser from CMSSW #// print "CMSSW python parser on %s \n ....it can take a while..."%cfgFile from FWCore.ParameterSet.Config import include from FWCore.ParameterSet.parsecf.pyparsing import * try: cmsCfg = include(cfgFile) except ParseException, ex: print "Error in CMSSW python parser: ParseException \n %s \n"%ex continue except ParseFatalException, ex: print "Error in CMSSW python parser: ParseFatalException \n %s \n"%ex continue cfgWrapper = CMSSWConfig() cfgWrapper.originalCfg = file(cfgFile).read() cfgInt = cfgWrapper.loadConfiguration(cmsCfg) cfgInt.validateForProduction() if testPythonMode: print "Test Python Mode:" print "python cfg parser successful for %s"% prodName print "EdmConfigHash successful for %s" % prodName # print "Python Config File: %s" % pycfgFile print "Hash: %s" % RealPSetHash continue if not workflowsOnly: # use MessageService ms = MessageService()