slowquery2es.py 文件源码

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

项目:rdsmant 作者: JangYoungWhan 项目源码 文件源码
def initLastTime(self, path):
        if not os.path.exists(path):
            cur_time = dself._now.strftime("%y%m%d %H:%M:%S")
            self._last_time = datetime.strptime(cur_time, "%y%m%d %H:%M:%S").isoformat()
            return False

        last_re = re.compile("last_time : (.*)\\n?")

        ifs = open(path, "r")
        lines = ifs.readlines()

        for l in reversed(lines):
            if not l: continue
            m = last_re.match(l)
            if m is not None:
                self._last_time = (m.groups(0))[0]
                ifs.close()
                return True
        ifs.close()

        cur_time = self._now.strftime("%y%m%d %H:%M:%S")
        self._last_time = datetime.strptime(cur_time, "%y%m%d %H:%M:%S").isoformat()
        return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号