def load(self, conf_file): conf = ConfigLoader(conf_file) result_tcp = conf.tcp_configloder() result_redis = conf.redis_configloder() if result_tcp is False or result_redis is False: logging.critical('Failed configloder...') return False self.conf = conf return True
class ConfigError(Exception): pass if __name__ == "__main__": try: makelog('topologyMysql') logging.info('START---------------') root_path = os.path.dirname(os.path.abspath(__file__)) config_file = os.path.join(root_path, 'configs', 'topology.ini') conf = ConfigLoader(config_file) result_redis = conf.redis_configloder() result_mysql = conf.mysql_configloder() if result_redis is False or result_mysql is False: raise ConfigError('Failed configloader...') mysql_client = connect_mysql(conf) if mysql_client: cur = mysql_client.cursor(DictCursor) connect_redis = connect_redis(conf) if connect_redis: while True: try: data = pop_redis(connect_redis, conf) logging.debug('data = %s' % data)