當前位置: 首頁>>代碼示例>>Python>>正文


Python Job.addFile方法代碼示例

本文整理匯總了Python中WMCore.DataStructs.Job.Job.addFile方法的典型用法代碼示例。如果您正苦於以下問題:Python Job.addFile方法的具體用法?Python Job.addFile怎麽用?Python Job.addFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WMCore.DataStructs.Job.Job的用法示例。


在下文中一共展示了Job.addFile方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: createTestJob

# 需要導入模塊: from WMCore.DataStructs.Job import Job [as 別名]
# 或者: from WMCore.DataStructs.Job.Job import addFile [as 別名]
    def createTestJob(self):
        """
        _createTestJob_

        Create a test job that has parents for each input file.

        """
        newJob = Job(name = "TestJob")
        newJob.addFile(File(lfn = "/some/file/one",
                            parents = set([File(lfn = "/some/parent/one")])))
        newJob.addFile(File(lfn = "/some/file/two",
                            parents = set([File(lfn = "/some/parent/two")])))
        return newJob
開發者ID:BrunoCoimbra,項目名稱:WMCore,代碼行數:15,代碼來源:SetupCMSSWPset_t.py

示例2: createTestJob

# 需要導入模塊: from WMCore.DataStructs.Job import Job [as 別名]
# 或者: from WMCore.DataStructs.Job.Job import addFile [as 別名]
    def createTestJob(self):
        """
        Create a test job to pass to the DashboardInterface

        """

        job = Job(name = "ThisIsASillyName")

        testFileA = File(lfn = "/this/is/a/lfnA", size = 1024, events = 10)
        testFileA.addRun(Run(1, *[45]))
        testFileB = File(lfn = "/this/is/a/lfnB", size = 1024, events = 10)
        testFileB.addRun(Run(1, *[46]))

        job.addFile(testFileA)
        job.addFile(testFileB)

        job['id'] = 1

        return job
開發者ID:AndrewLevin,項目名稱:WMCore,代碼行數:21,代碼來源:DashboardInterface_t.py

示例3: JobTest

# 需要導入模塊: from WMCore.DataStructs.Job import Job [as 別名]
# 或者: from WMCore.DataStructs.Job.Job import addFile [as 別名]
class JobTest(unittest.TestCase):
    """
    _JobTest_

    Testcase for the Job class

    Instantiate a dummy Job object with a dummy Subscription
    and a dummy Fileset full of random files as input
    """

    def setUp(self):
        """
        _setUp_

        Initial Setup for the Job Testcase
        """
        self.inputFiles = []

        for i in range(1,1000):
            lfn = "/store/data/%s/%s/file.root" % (random.randint(1000, 9999),
                                                   random.randint(1000, 9999))
            size = random.randint(1000, 2000)
            events = 1000
            run = random.randint(0, 2000)
            lumi = random.randint(0, 8)

            file = File(lfn = lfn, size = size, events = events, checksums = {"cksum": "1"})
            file.addRun(Run(run, *[lumi]))
            self.inputFiles.append(file)

        self.dummyJob = Job(files = self.inputFiles)
        return

    def tearDown(self):
        """
        No tearDown method for this Testcase
        """
        pass

    def testGetFilesList(self):
        """
        _testGetFilesList_

        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):
#.........這裏部分代碼省略.........
開發者ID:alexanderrichards,項目名稱:WMCore,代碼行數:103,代碼來源:Job_t.py


注:本文中的WMCore.DataStructs.Job.Job.addFile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。