示例#1
0
 def testBinPacking(self):
     """
     Tests the bin-packing method used by the cluster scaler.
     """
     for test in range(50):
         nodeShapes = [
             Shape(wallTime=random.choice(list(range(1, 100))),
                   memory=random.choice(list(range(1, 10))),
                   cores=random.choice(list(range(1, 10))),
                   disk=random.choice(list(range(1, 10))),
                   preemptable=False) for i in range(5)
         ]
         randomJobShape = lambda x: Shape(
             wallTime=random.choice(list(range(1, (3 * x.wallTime) + 1))),
             memory=random.choice(list(range(1, x.memory + 1))),
             cores=random.choice(list(range(1, x.cores + 1))),
             disk=random.choice(list(range(1, x.disk + 1))),
             preemptable=False)
         randomJobShapes = []
         for nodeShape in nodeShapes:
             numberOfJobs = random.choice(list(range(1, 1000)))
             randomJobShapes.extend(
                 [randomJobShape(nodeShape) for i in range(numberOfJobs)])
         startTime = time.time()
         numberOfBins = binPacking(jobShapes=randomJobShapes,
                                   nodeShapes=nodeShapes)
         logger.info("Made the following node reservations: %s" %
                     numberOfBins)
示例#2
0
 def testBinPacking(self):
     """
     Tests the bin-packing method used by the cluster scaler.
     """
     for test in xrange(50):
         nodeShape = Shape(wallTime=random.choice(range(1, 100)),
                           memory=random.choice(range(1, 10)),
                           cores=random.choice(range(1, 10)),
                           disk=random.choice(range(1, 10)))
         randomJobShape = lambda x: Shape(wallTime=random.choice(range(1, (3 * x.wallTime) + 1)),
                                          memory=random.choice(range(1, x.memory + 1)),
                                          cores=random.choice(range(1, x.cores + 1)),
                                          disk=random.choice(range(1, x.disk + 1)))
         numberOfJobs = random.choice(range(1, 1000))
         randomJobShapes = map(lambda i: randomJobShape(nodeShape), xrange(numberOfJobs))
         startTime = time.time()
         numberOfBins = binPacking(randomJobShapes, nodeShape)
         logger.info("For node shape %s and %s job-shapes got %s bins in %s seconds, %s jobs/bin" % 
                     (nodeShape, numberOfJobs, numberOfBins, time.time() - startTime, float(numberOfJobs)/numberOfBins))
示例#3
0
 def testBinPacking(self):
     """
     Tests the bin-packing method used by the cluster scaler.
     """
     for test in xrange(50):
         nodeShape = Shape(wallTime=random.choice(range(1, 100)),
                           memory=random.choice(range(1, 10)),
                           cores=random.choice(range(1, 10)),
                           disk=random.choice(range(1, 10)))
         randomJobShape = lambda x: Shape(wallTime=random.choice(range(1, (3 * x.wallTime) + 1)),
                                          memory=random.choice(range(1, x.memory + 1)),
                                          cores=random.choice(range(1, x.cores + 1)),
                                          disk=random.choice(range(1, x.disk + 1)))
         numberOfJobs = random.choice(range(1, 1000))
         randomJobShapes = map(lambda i: randomJobShape(nodeShape), xrange(numberOfJobs))
         startTime = time.time()
         numberOfBins = binPacking(randomJobShapes, nodeShape)
         logger.info("For node shape %s and %s job-shapes got %s bins in %s seconds, %s jobs/bin" % 
                     (nodeShape, numberOfJobs, numberOfBins, time.time() - startTime, float(numberOfJobs)/numberOfBins))