Beispiel #1
0
    def pool(self, key, image):
        """ pool - Get information about pool(s) of VMs
        """
        self.log.debug("Received pool request(%s, %s)" % (key, image))
        if self.validateKey(key):
            pools = self.tango.preallocator.getAllPools()
            self.log.info("All pools found")
            if image == "":
                result = self.status.obtained_all_pools
            else:
                if image in pools:
                    pools = {image: pools[image]}
                    self.log.info("Pool image found: %s" % image)
                    result = self.status.obtained_pool
                else:
                    self.log.info("Invalid image name: %s" % image)
                    result = self.status.pool_not_found

            result["pools"] = pools
            result["low_water_mark"] = TangoIntValue("low_water_mark", -1).get()
            result["max_pool_size"] = TangoIntValue("max_pool_size", -1).get()
            return result
        else:
            self.log.info("Key not recognized: %s" % key)
            return self.status.wrong_key
Beispiel #2
0
 def test_sharedInt(self):
     if Config.USE_REDIS:
         num1 = TangoIntValue("nextID", 1000)
         num2 = TangoIntValue("nextID", 3000)
         self.assertEqual(num1.get(), 1000)
         self.assertEqual(num1.get(), num2.get())
     else:
         return
Beispiel #3
0
 def __init__(self, vmms):
     self.machines = TangoDictionary("machines")
     self.lock = threading.Lock()
     self.nextID = TangoIntValue("nextID", 1000)
     self.vmms = vmms
     self.log = logging.getLogger("Preallocator-" + str(os.getpid()))
     self.low_water_mark = TangoIntValue("low_water_mark", -1)
     if (hasattr(Config, 'POOL_SIZE_LOW_WATER_MARK')
             and Config.POOL_SIZE_LOW_WATER_MARK >= 0):
         self.low_water_mark.set(Config.POOL_SIZE_LOW_WATER_MARK)
Beispiel #4
0
 def __init__(self, preallocator):
     # Create two dictionaries that, for each job currently in the dictionary, also maintains a mapping
     # from output file to the job. This allows easy, constant-time lookup for job based on output file.
     self.liveJobs = WrappingDictionary("liveJobsWrapped",
                                        TangoDictionary("liveJobs"),
                                        lambda j: j.outputFile)
     self.deadJobs = WrappingDictionary("deadJobsWrapped",
                                        TangoDictionary("deadJobs"),
                                        lambda j: j.outputFile)
     self.queueLock = threading.Lock()
     self.preallocator = preallocator
     self.log = logging.getLogger("JobQueue")
     self.nextID = 1
     self.max_pool_size = TangoIntValue("max_pool_size", -1)
     if (hasattr(Config, 'MAX_POOL_SIZE') and Config.MAX_POOL_SIZE >= 0):
         self.max_pool_size.set(Config.MAX_POOL_SIZE)
Beispiel #5
0
 def __init__(self, vmms):
     self.machines = TangoDictionary("machines")
     self.lock = threading.Lock()
     self.nextID = TangoIntValue("nextID", 1000)
     self.vmms = vmms
     self.log = logging.getLogger("Preallocator")