driver.py 文件源码

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

项目:aerospike-telemetry-agent 作者: aerospike 项目源码 文件源码
def run(self):
        # Get info port of ASD.
        node_init_path = self.options['config-file']
        configParser = Parser(node_init_path)
        if (configParser.parse() != 0):
            logging.critical("Port not found in config file.")
            sys.exit(-1)
        logging.info("Leaf Node port: %s. Home server: %s " % (configParser.port, self.options['home-url']))

        # Get leaf connection.
        self.leafConnection = LeafLine(configParser.port, self.leafAddress)

        if self.options['sample']:
            infoMap = self.get_info()
            if infoMap:
                logging.info("infoMap = %s", pprint.pformat(infoMap, indent=2))
            else:
                logging.warning("No info. returned from ASD!")
            return

        self.wait_for_leaf_connection(True)

        # Collect data.
        while True:
            infoMap = self.get_info()
            if infoMap:
                self.phonehome(infoMap)
            else:
                # Report ASD is down.
                logging.info("Sending back status: ASD is down.")
                self.phonehome({"telemetry-agent-status": "ASD is down."})

                # Attempt to reconnect.
                self.leafConnection = LeafLine(configParser.port, self.leafAddress)
                self.wait_for_leaf_connection()

            time.sleep(self.options['interval'])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号