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


Python Job.changeOutcome方法代码示例

本文整理汇总了Python中WMCore.DataStructs.Job.Job.changeOutcome方法的典型用法代码示例。如果您正苦于以下问题:Python Job.changeOutcome方法的具体用法?Python Job.changeOutcome怎么用?Python Job.changeOutcome使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WMCore.DataStructs.Job.Job的用法示例。


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

示例1: JobTest

# 需要导入模块: from WMCore.DataStructs.Job import Job [as 别名]
# 或者: from WMCore.DataStructs.Job.Job import changeOutcome [as 别名]

#.........这里部分代码省略.........
        Verify that the Job::getFiles(type = "list") method returns the same
        files in the same order that they were passed in.
        """
        assert self.dummyJob.getFiles() == self.inputFiles, \
            "ERROR: Initial fileset does not match Job fileset"

        return

    def testGetFilesSet(self):
        """
        _testGetFilesSet_

        Verify that the Job::getFiles(type = "set") method returns the correct
        input files in the form of a set.
        """
        assert self.dummyJob.getFiles(type = "set") == set(self.inputFiles), \
            "ERROR: getFiles(type = 'set') does not work correctly."

        return

    def testGetFilesLFN(self):
        """
        _testGetFilesLFN_

        Verify that the Job::getFiles(type = "lfn") method returns the same
        files in the same order that they were passed in.
        """
        jobLFNs = self.dummyJob.getFiles(type = "lfn")

        goldenLFNs = []
        for file in self.inputFiles:
            goldenLFNs.append(file["lfn"])

        assert len(goldenLFNs) == len(jobLFNs), \
            "ERROR: Job has different number of files than input"

        for jobLFN in jobLFNs:
            assert jobLFN in goldenLFNs, \
                "ERROR: LFN missing from job."

        return

    def testAddFile(self):
        """
        _testAddFile_

        Verify that the Job::addFile() method works properly.
        """
        dummyFileAddFile = File("/tmp/dummyFileAddFileTest", 1234, 1, 2)
        self.dummyJob.addFile(dummyFileAddFile)

        assert dummyFileAddFile in self.dummyJob.getFiles(), \
            "ERROR: Couldn't add file to Job - addFile method error"

        return

    def testChangeState(self):
        """
        _testChangeState_

        Verify that the Job::changeState() method updates the state and the
        state time.
        """
        currentTime = time.time()
        self.dummyJob.changeState("created")

        assert self.dummyJob["state_time"] > currentTime - 1 and \
            self.dummyJob["state_time"] < currentTime + 1, \
            "ERROR: State time not updated on state change"

        assert self.dummyJob["state"] == "created", \
            "ERROR: Couldn't change Job state - changeState method error"

    def testChangeOutcome(self):
        """
        _testChangeOutcome_

        Verify that the Job::changeOutcome() method changes the final outcome
        of the job.
        """
        self.dummyJob.changeOutcome("success")

        assert self.dummyJob["outcome"] == "success", \
            "ERROR: Job outcome failed to update."

        return

    def testGetBaggage(self):
        """
        test that setting/accessing the Job Baggage ConfigSection works
        """
        self.dummyJob.addBaggageParameter("baggageContents", True)
        self.dummyJob.addBaggageParameter("trustPUSitelists", False)
        self.dummyJob.addBaggageParameter("skipPileupEvents", 20000)

        baggage = self.dummyJob.getBaggage()
        self.assertTrue(getattr(baggage, "baggageContents"))
        self.assertFalse(getattr(baggage, "trustPUSitelists"))
        self.assertEqual(getattr(baggage, "skipPileupEvents"), 20000)
        self.assertFalse(hasattr(baggage, "IDontExist"))
开发者ID:alexanderrichards,项目名称:WMCore,代码行数:104,代码来源:Job_t.py


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