KeyPartitionCache.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:sdos-core 作者: sdos 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号