当前位置: 首页>>代码示例>>Python>>正文


Python PSetTweak.PSetTweak类代码示例

本文整理汇总了Python中PSetTweaks.PSetTweak.PSetTweak的典型用法代码示例。如果您正苦于以下问题:Python PSetTweak类的具体用法?Python PSetTweak怎么用?Python PSetTweak使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PSetTweak类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: handleSeeding

 def handleSeeding(self):
     """
     _handleSeeding_
     
     Handle Random Seed settings for the job
     
     """
     baggage = self.job.getBaggage()
     seeding = getattr(baggage, "seeding", None)
     if seeding == None:
         return
     if seeding == "AutomaticSeeding":
         from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper
         helper = RandomNumberServiceHelper(self.process.RandomNumberGeneratorService)
         helper.populate()
         return
     if seeding == "ReproducibleSeeding":
         randService = self.process.RandomNumberGeneratorService
         tweak = PSetTweak()
         for x in randService:
             parameter = "process.RandomNumberGeneratorService.%s.initialSeed" % x._internal_name
             tweak.addParameter(parameter, x.initialSeed)
         applyTweak(self.process, tweak, self.fixupDict)
         return
     # still here means bad seeding algo name
     raise RuntimeError, "Bad Seeding Algorithm: %s" % seeding
开发者ID:zhiwenuil,项目名称:WMCore,代码行数:26,代码来源:SetupCMSSWPset.py

示例2: applyTweak

    def applyTweak(self, psetTweak):
        """
        _applyTweak_

        Apply a tweak to the process.
        """
        tweak = PSetTweak()
        tweak.unpersist(psetTweak)
        applyTweak(self.process, tweak, self.fixupDict)
        return
开发者ID:huohuo21,项目名称:WMCore,代码行数:10,代码来源:SetupCMSSWPset.py

示例3: __call__

    def __call__(self, process):
        tweak = PSetTweak()
        # handle process parameters
        processParams = []
        [ processParams.extend( expandParameter(process, param).keys())
          for param in self.processLevel]


        [ tweak.addParameter(param, getParameter(process, param))
          for param in processParams if hasParameter(process, param) ]

        # output modules
        tweak.addParameter('process.outputModules_', [])
        for outMod in process.outputModules_():
            tweak.getParameter('process.outputModules_').append(outMod)
            outModRef = getattr(process, outMod)
            for param in self.outModLevel:
                fullParam = "process.%s.%s" % (outMod, param)
                if hasParameter(outModRef, param, True):
                    tweak.addParameter(
                        fullParam,
                        getParameter(outModRef,
                                     param,
                                     True))


        return tweak
开发者ID:AndrewLevin,项目名称:WMCore,代码行数:27,代码来源:WMTweak.py

示例4: testC

    def testC(self):
        """test building a tweak from the seeds"""
        job = Job("TestJob")
        seeder = AutomaticSeeding()

        job.addBaggageParameter("process.RandomNumberGeneratorService.seed1.initialSeed", 123445)
        job.addBaggageParameter("process.RandomNumberGeneratorService.seed2.initialSeed", 123445)
        job.addBaggageParameter("process.RandomNumberGeneratorService.seed3.initialSeed", 7464738)
        job.addBaggageParameter("process.RandomNumberGeneratorService.seed44.initialSeed", 98273762)


        seeder(job)

        tweak = PSetTweak()
        for x in job.baggage.process.RandomNumberGeneratorService:
            parameter = "process.RandomNumberGeneratorService.%s.initialSeed" % x._internal_name
            tweak.addParameter(parameter, x.initialSeed)
        print(tweak)
开发者ID:BrunoCoimbra,项目名称:WMCore,代码行数:18,代码来源:AutomaticSeeding_t.py

示例5: makeTaskTweak

def makeTaskTweak(stepSection):
    """
    _makeTaskTweak_

    Create a tweak for options in the task that apply to all jobs.
    """
    result = PSetTweak()

    # GlobalTag
    if hasattr(stepSection, "application"):
        if hasattr(stepSection.application, "configuration"):
            if hasattr(stepSection.application.configuration, "arguments"):
                globalTag = getattr(stepSection.application.configuration.arguments,
                                    "globalTag", None)
                if globalTag != None:
                    result.addParameter("process.GlobalTag.globaltag", globalTag)

    return result
开发者ID:zhiwenuil,项目名称:WMCore,代码行数:18,代码来源:WMTweak.py

示例6: makeTaskTweak

def makeTaskTweak(stepSection):
    """
    _makeTaskTweak_

    Create a tweak for options in the task that apply to all jobs.
    """
    result = PSetTweak()

    # GlobalTag
    if hasattr(stepSection, "application"):
        if hasattr(stepSection.application, "configuration"):
            if hasattr(stepSection.application.configuration, "pickledarguments"):
                args = pickle.loads(stepSection.application.configuration.pickledarguments)
                if args.has_key('globalTag'):
                    result.addParameter("process.GlobalTag.globaltag", args['globalTag'])
                if args.has_key('globalTagTransaction'):
                    result.addParameter("process.GlobalTag.DBParameters.transactionId", args['globalTagTransaction'])

    return result
开发者ID:AndrewLevin,项目名称:WMCore,代码行数:19,代码来源:WMTweak.py

示例7: handleSeeding

    def handleSeeding(self):
        """
        _handleSeeding_

        Handle Random Seed settings for the job
        """
        baggage = self.job.getBaggage()
        seeding = getattr(baggage, "seeding", None)
        if seeding == "ReproducibleSeeding":
            randService = self.process.RandomNumberGeneratorService
            tweak = PSetTweak()
            for x in randService:
                parameter = "process.RandomNumberGeneratorService.%s.initialSeed" % x._internal_name
                tweak.addParameter(parameter, x.initialSeed)
            applyTweak(self.process, tweak, self.fixupDict)
        else:
            if hasattr(self.process, "RandomNumberGeneratorService"):
                from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper
                helper = RandomNumberServiceHelper(self.process.RandomNumberGeneratorService)
                helper.populate()
        return
开发者ID:huohuo21,项目名称:WMCore,代码行数:21,代码来源:SetupCMSSWPset.py

示例8: makeOutputTweak

def makeOutputTweak(outMod, job):
    """
    _makeOutputTweak_

    Make a PSetTweak for the output module and job instance provided

    """
    result = PSetTweak()
    # output filenames
    modName = str(getattr(outMod, "_internal_name"))
    fileName = "%s.root" % modName

    result.addParameter("process.%s.fileName" % modName, fileName)

    lfnBase = str(getattr(outMod, "lfnBase", None))
    if lfnBase != None:
        lfn = "%s/%s/%s.root" % (lfnBase, lfnGroup(job), modName)
        result.addParameter("process.%s.logicalFileName" % modName, lfn)

    # TODO: Nice standard way to meddle with the other parameters in the
    #      output module based on the settings in the section

    return result
开发者ID:PerilousApricot,项目名称:WMCore,代码行数:23,代码来源:WMTweak.py

示例9: makeJobTweak

def makeJobTweak(job):
    """
    _makeJobTweak_

    Convert information from a WMBS Job object into a PSetTweak
    that can be used to modify a CMSSW process.
    """
    result = PSetTweak()
    baggage = job.getBaggage()

    # Check in the baggage if we are processing .lhe files
    lheInput = getattr(baggage, "lheInputFiles", False)

    # Input files and secondary input files.
    primaryFiles = []
    secondaryFiles = []
    for inputFile in job["input_files"]:
        if inputFile["lfn"].startswith("MCFakeFile"):
            # If there is a preset lumi in the mask, use it as the first
            # luminosity setting
            if job['mask'].get('FirstLumi', None) != None:
                result.addParameter("process.source.firstLuminosityBlock",
                                    job['mask']['FirstLumi'])
            else:
                #We don't have lumi information in the mask, raise an exception
                raise WMTweakMaskError(job['mask'],
                                       "No first lumi information provided")
            continue

        primaryFiles.append(inputFile["lfn"])
        for secondaryFile in inputFile["parents"]:
            secondaryFiles.append(secondaryFile["lfn"])

    if len(primaryFiles) > 0:
        result.addParameter("process.source.fileNames", primaryFiles)
        if len(secondaryFiles) > 0:
            result.addParameter("process.source.secondaryFileNames", secondaryFiles)
    elif not lheInput:
        #First event parameter should be set from whatever the mask says,
        #That should have the added protection of not going over 2^32 - 1
        #If there is nothing in the mask, then we fallback to the counter method
        if job['mask'].get('FirstEvent',None) != None:
            result.addParameter("process.source.firstEvent",
                                job['mask']['FirstEvent'])
        else:
            #No first event information in the mask, raise and error
            raise WMTweakMaskError(job['mask'],
                                   "No first event information provided in the mask")

    mask =  job['mask']

    # event limits
    maxEvents = mask.getMaxEvents()
    if maxEvents == None: maxEvents = -1
    result.addParameter("process.maxEvents.input", maxEvents)

    # We don't want to set skip events for MonteCarlo jobs which have
    # no input files.
    firstEvent = mask['FirstEvent']
    if firstEvent != None and firstEvent >= 0 and (len(primaryFiles) > 0 or lheInput):
        if lheInput:
            result.addParameter("process.source.skipEvents", firstEvent - 1)
        else:
            result.addParameter("process.source.skipEvents", firstEvent)

    firstRun = mask['FirstRun']
    if firstRun != None:
        result.addParameter("process.source.firstRun", firstRun)
    elif not len(primaryFiles):
        #Then we have a MC job, we need to set firstRun to 1
        logging.debug("MCFakeFile initiated without job FirstRun - using one.")
        result.addParameter("process.source.firstRun", 1)

    runs = mask.getRunAndLumis()
    lumisToProcess = []
    for run in runs.keys():
        lumiPairs = runs[run]
        for lumiPair in lumiPairs:
            if len(lumiPair) != 2:
                # Do nothing
                continue
            lumisToProcess.append("%s:%s-%s:%s" % (run, lumiPair[0], run, lumiPair[1]))

    if len(lumisToProcess) > 0:
        result.addParameter("process.source.lumisToProcess", lumisToProcess)

    # install any settings from the per job baggage
    procSection = getattr(baggage, "process", None)
    if procSection == None:
        return result

    baggageParams = decomposeConfigSection(procSection)
    for k,v in baggageParams.items():
        result.addParameter(k,v)


    return result
开发者ID:AndrewLevin,项目名称:WMCore,代码行数:97,代码来源:WMTweak.py


注:本文中的PSetTweaks.PSetTweak.PSetTweak类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。