예제 #1
0
    def __call__(self, wmTask):
        """
        Trip through steps, find CMSSW steps, pull in config files,
        PSet Tweaks etc

        """
        for t in wmTask.steps().nodeIterator():
            t = WMStep.WMStepHelper(t)
            stepPath = "%s/%s" % (self.workingDirectory(), t.name())

            # the CMSSW has a special case with its ConfigCache argument
            if not t.stepType() in ("CMSSW", "MulticoreCMSSW"): continue
            if getattr(t.data.application.configuration, 'configCacheUrl', None) != None:
                # main config file
                fileTarget = "%s/%s" % (
                    stepPath,
                    t.data.application.command.configuration)
                #urllib.urlretrieve(
                #    t.data.application.configuration.retrieveConfigUrl,
                #    fileTarget)
                # PSet Tweak
                cacheUrl = t.data.application.configuration.configCacheUrl
                cacheDb  = t.data.application.configuration.cacheName
                configId = t.data.application.configuration.configId
                tweakTarget = t.data.application.command.psetTweak

                configCache = ConfigCache(cacheUrl, cacheDb)
                configCache.loadByID(configId)
                configCache.saveConfigToDisk(targetFile = fileTarget)
                tweak = TweakAPI.makeTweakFromJSON(configCache.getPSetTweaks())
                if tweak:
                    tweakFile = "%s/%s" % (stepPath, tweakTarget)
                    tweak.persist(tweakFile, "json")
예제 #2
0
    def testB(self):
        """adding attributes"""

        tweak = PSetTweak.PSetTweak()
        tweak.addParameter("process.source.logicalFileNames",
                           ["/store/whatever"])
        tweak.addParameter("process.source.fileNames",
                           ["file:/store/whatever"])
예제 #3
0
    def testE(self):
        """jsonise"""
        tweak = PSetTweak.PSetTweak()
        tweak.addParameter("process.source.logicalFileNames",
                           ["/store/whatever"])
        tweak.addParameter("process.source.fileNames",
                           ["file:/store/whatever"])
        tweak.addParameter("process.module1.module2.module3.parameter1",
                           ["file:/store/whatever", "file:/store/whatever2"])
        tweak.addParameter("process.module1.module2.module3.parameter2",
                           ["file:/store/whatever"])
        tweak.addParameter("process.module1.module2.module3.parameter3",
                           ["file:/store/whatever"])
        tweak.addParameter("process.module1.module2.module3.parameter4", 1234)

        #print tweak.jsonise()

        persistFile = "%s/PSetTweak_persist.json" % self.testDir
        tweak.persist(persistFile, "json")
        tweak2 = PSetTweak.PSetTweak()
        tweak2.unpersist(persistFile)
예제 #4
0
    def testC(self):
        """iterating"""
        tweak = PSetTweak.PSetTweak()
        tweak.addParameter("process.source.logicalFileNames",
                           ["/store/whatever"])
        tweak.addParameter("process.source.fileNames",
                           ["file:/store/whatever"])

        tweak.addParameter("process.module1.module2.module3.parameter1",
                           ["file:/store/whatever", "file:/store/whatever2"])
        tweak.addParameter("process.module1.module2.module3.parameter2",
                           ["file:/store/whatever"])
        tweak.addParameter("process.module1.module2.module3.parameter3",
                           ["file:/store/whatever"])
        tweak.addParameter("process.module1.module2.module3.parameter4", 1234)
예제 #5
0
    def testA(self):
        """init"""

        tweak = PSetTweak.PSetTweak()