def __watch_and_store_partitions(self):
"""
Flush all the dirty partitions to the backend store. This methods gets called periodically on a timer
:return:
"""
logging.debug("checking for dirty partitions in cache: {} found".format(len(self.__dirty_partitions)))
while self.__dirty_partitions:
pid = self.__dirty_partitions.pop()
logging.warning("flushing modified partition {} from cache to mgmt container {}".format(pid,
self.partitionStore.containerNameSdosMgmt))
try:
self.partitionStore.writePartition(pid, io.BytesIO(self.partitionCache[pid]))
except Exception:
self.__dirty_partitions.add(pid)
logging.exception(
"storing changed partition {} failed! {} dirty partitions left to store. Leaving this execution.".format(
pid, len(self.__dirty_partitions)))
break
threading.Timer(10, self.__watch_and_store_partitions).start()
评论列表
文章目录