dbwrapper.py 文件源码

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

项目:emem 作者: julianes10 项目源码 文件源码
def tryReconnect(self):
      helper.internalLogger.info("Try reconnection to database" + self.dbname)
      try:
        """Instantiate a connection to the InfluxDB."""
        self.client = InfluxDBClient(self.host, self.port, self.user, self.password,self.dbname)

        helper.internalLogger.info("Create database: " + self.dbname)
        self.client.create_database(self.dbname)

        helper.internalLogger.info("Create a retention policy")
        self.client.create_retention_policy('awesome_policy', '3d', 3,default=True)

        helper.internalLogger.info("Switch user: " + self.dbuser)
        self.client.switch_user(self.dbuser, self.dbpss)
      except KeyboardInterrupt:
          print("Ok ok, quitting")
          sys.exit(1)
      except Exception as e:
          e = sys.exc_info()[0]
          helper.internalLogger.error('Unexpected error attempting to access to BD. It will be retried later.')
          helper.einternalLogger.exception(e)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号