コード例 #1
0
    def handleEnforceGUIDInFileName(self):
        """
        _handleEnforceGUIDInFileName_

        Enable enforceGUIDInFileName for CMSSW releases that support it.
        """
        # skip it for CRAB jobs
        if self.crabPSet:
            return

        # only check this if we are in the first step of a workflow as output files of chained processing
        # steps will not have correct GUID information
        if self.step.data._internal_name != "cmsRun1":
            self.logger.info("Not evaluating enforceGUIDInFileName parameter for step %s",
                             self.step.data._internal_name)
            return

        # only enable if source is PoolSource or EmbeddedRootSource
        if self.process.source.type_() not in ["PoolSource", "EmbeddedRootSource"]:
            self.logger.info("Not evaluating enforceGUIDInFileName parameter for process source %s",
                             self.process.source.type_())
            return

        self.logger.info("Evaluating if release %s supports enforceGUIDInFileName parameter...",
                         self.getCmsswVersion())

        # enable if release supports enforceGUIDInFileName and parameter is not set
        if (isEnforceGUIDInFileNameSupported(self.getCmsswVersion()) and
                not hasattr(self.process.source, "enforceGUIDInFileName")):
            self.logger.info("Setting enforceGUIDInFileName to True.")
            self.process.source.enforceGUIDInFileName = cms.untracked.bool(True)
        else:
            self.logger.info("CMSSW release does not support enforceGUIDInFileName.")

        return
コード例 #2
0
    def handleEnforceGUIDInFileName(self, secondaryInput=None):
        """
        _handleEnforceGUIDInFileName_

        Enable enforceGUIDInFileName for CMSSW releases that support it.
        """
        # skip it for CRAB jobs
        if self.crabPSet:
            return

        if secondaryInput:
            inputSource = secondaryInput
            self.logger.info(
                "Evaluating enforceGUIDInFileName parameter for secondary input data."
            )
        else:
            inputSource = self.process.source

        # only enable if source is PoolSource or EmbeddedRootSource
        if inputSource.type_() not in ["PoolSource", "EmbeddedRootSource"]:
            self.logger.info(
                "Not evaluating enforceGUIDInFileName parameter for process source %s",
                inputSource.type_())
            return

        self.logger.info(
            "Evaluating if release %s supports enforceGUIDInFileName parameter...",
            self.getCmsswVersion())

        # enable if release supports enforceGUIDInFileName
        if isEnforceGUIDInFileNameSupported(self.getCmsswVersion()):
            # check to make sure primary input files follow guid naming convention
            # prevents enabling guid checks on some workflows (StoreResults/StepChain) that use custom input file names
            # EmbeddedRootSource input files will always follow guid naming convention
            if inputSource.type_() == "PoolSource" and inputSource.fileNames:
                guidRegEx = re.compile(
                    "[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}.root$"
                )
                if not guidRegEx.search(inputSource.fileNames[0]):
                    self.logger.info(
                        "Not enabling enforceGUIDInFileName due to non-GUID input file names"
                    )
                    return
            self.logger.info("Setting enforceGUIDInFileName to True.")
            inputSource.enforceGUIDInFileName = cms.untracked.bool(True)
        else:
            self.logger.info(
                "CMSSW release does not support enforceGUIDInFileName.")

        return
コード例 #3
0
ファイル: Scram_t.py プロジェクト: todor-ivanov/WMCore
    def testisEnforceGUIDInFileNameSupported(self):
        """
        Test functionality of the `isEnforceGUIDInFileNameSupported` function
        """
        ### invalid input
        self.assertFalse(isEnforceGUIDInFileNameSupported(None))
        self.assertFalse(isEnforceGUIDInFileNameSupported(''))

        ### forever supported
        self.assertTrue(isEnforceGUIDInFileNameSupported('CMSSW_11_0_0'))
        self.assertTrue(isEnforceGUIDInFileNameSupported('CMSSW_11_0_2'))
        self.assertTrue(isEnforceGUIDInFileNameSupported('CMSSW_11_1_0_pre1'))
        self.assertTrue(
            isEnforceGUIDInFileNameSupported('CMSSW_11_1_0_patch1'))
        self.assertTrue(isEnforceGUIDInFileNameSupported('CMSSW_11_1_1'))

        ### specific releases
        self.assertTrue(isEnforceGUIDInFileNameSupported('CMSSW_10_2_20_UL'))
        self.assertTrue(isEnforceGUIDInFileNameSupported('CMSSW_9_4_16_UL'))
        self.assertTrue(isEnforceGUIDInFileNameSupported('CMSSW_8_0_34_UL'))
        self.assertTrue(
            isEnforceGUIDInFileNameSupported('CMSSW_7_1_45_patch3'))

        ### minor supported releases
        self.assertTrue(isEnforceGUIDInFileNameSupported('CMSSW_10_6_8'))
        self.assertTrue(isEnforceGUIDInFileNameSupported('CMSSW_10_6_9'))
        self.assertTrue(
            isEnforceGUIDInFileNameSupported('CMSSW_10_6_8_patch1'))
        self.assertTrue(
            isEnforceGUIDInFileNameSupported('CMSSW_10_6_9_patch1'))
        self.assertTrue(isEnforceGUIDInFileNameSupported('CMSSW_10_2_20'))
        self.assertTrue(isEnforceGUIDInFileNameSupported('CMSSW_9_4_16'))
        self.assertTrue(isEnforceGUIDInFileNameSupported('CMSSW_9_3_17'))
        self.assertTrue(isEnforceGUIDInFileNameSupported('CMSSW_8_0_34'))

        ### releases not supported
        self.assertFalse(isEnforceGUIDInFileNameSupported('CMSSW_10_6_7'))
        self.assertFalse(isEnforceGUIDInFileNameSupported('CMSSW_10_7_0'))
        self.assertFalse(isEnforceGUIDInFileNameSupported('CMSSW_10_2_19'))
        self.assertFalse(isEnforceGUIDInFileNameSupported('CMSSW_10_3_10'))
        self.assertFalse(isEnforceGUIDInFileNameSupported('CMSSW_5_3_10'))