示例#1
0
        def testPromisedRequirementStatic(self):
            """
            Asserts that promised core resources are allocated properly using a static DAG
            """
            for coresPerJob in self.allocatedCores:
                tempDir = self._createTempDir('testFiles')
                counterPath = self.getCounterPath(tempDir)

                root = Job()
                one = Job.wrapFn(getOne, cores=0.1, memory='32M', disk='1M')
                thirtyTwoMb = Job.wrapFn(getThirtyTwoMb,
                                         cores=0.1,
                                         memory='32M',
                                         disk='1M')
                root.addChild(one)
                root.addChild(thirtyTwoMb)
                for _ in range(self.cpuCount):
                    root.addFollowOn(
                        Job.wrapFn(batchSystemTest.measureConcurrency,
                                   counterPath,
                                   cores=PromisedRequirement(
                                       lambda x: x * coresPerJob, one.rv()),
                                   memory=PromisedRequirement(
                                       thirtyTwoMb.rv()),
                                   disk='1M'))
                Job.Runner.startToil(root, self.getOptions(tempDir))
                _, maxValue = batchSystemTest.getCounters(counterPath)
                self.assertEqual(maxValue, self.cpuCount / coresPerJob)
示例#2
0
 def getCounterPath(self, tempDir):
     """
     Returns path to a counter file
     :param str tempDir: path to test directory
     :return: path to counter file
     """
     counterPath = os.path.join(tempDir, 'counter')
     batchSystemTest.resetCounters(counterPath)
     minValue, maxValue = batchSystemTest.getCounters(counterPath)
     assert (minValue, maxValue) == (0, 0)
     return counterPath
 def getCounterPath(self, tempDir):
     """
     Returns path to a counter file
     :param str tempDir: path to test directory
     :return: path to counter file
     """
     counterPath = os.path.join(tempDir, 'counter')
     batchSystemTest.resetCounters(counterPath)
     minValue, maxValue = batchSystemTest.getCounters(counterPath)
     assert (minValue, maxValue) == (0, 0)
     return counterPath
        def testPromisedRequirementStatic(self):
            """
            Asserts that promised core resources are allocated properly using a static DAG
            """
            for coresPerJob in self.allocatedCores:
                tempDir = self._createTempDir('testFiles')
                counterPath = self.getCounterPath(tempDir)

                root = Job()
                one = Job.wrapFn(getOne, cores=0.1, memory='32M', disk='1M')
                thirtyTwoMb = Job.wrapFn(getThirtyTwoMb, cores=0.1, memory='32M', disk='1M')
                root.addChild(one)
                root.addChild(thirtyTwoMb)
                for _ in range(self.cpuCount):
                    root.addFollowOn(Job.wrapFn(batchSystemTest.measureConcurrency, counterPath,
                                                cores=PromisedRequirement(lambda x: x * coresPerJob, one.rv()),
                                                memory=PromisedRequirement(thirtyTwoMb.rv()),
                                                disk='1M'))
                Job.Runner.startToil(root, self.getOptions(tempDir))
                _, maxValue = batchSystemTest.getCounters(counterPath)
                self.assertEqual(maxValue, self.cpuCount / coresPerJob)