def __init__(self, *args, **kwargs): AbstractLoadManager.__init__(self, *args, **kwargs) if not self.SUPPORTS_GUARANTEES: self.logger.warning("Memory guarantees are not supported by " "the load manager and will be ignored") self.unused_mem_estimator = None if self.TRACK_UNUSED_MEM: if UnusedMemEstimator.is_available(): if config.MEMCG__MEM_INUSE_TIME != 0: self.unused_mem_estimator = UnusedMemEstimator( config.MEMCG__MEM_INUSE_TIME, self.update, self.logger) else: self.logger.error("Failed to activate idle memory estimator: " "Not supported by the kernel")
def shutdown(self): if self.unused_mem_estimator: self.unused_mem_estimator.shutdown() AbstractLoadManager.shutdown(self)
def serve_forever(self): if self.unused_mem_estimator: threading.Thread(target=self.unused_mem_estimator. serve_forever).start() AbstractLoadManager.serve_forever(self)