def __init__(self, lazy_connection=False):
"""Constructor. Initialize the client.
Parameters:
lazy_connection: avoid testing if the connection is working while
initializing it.
"""
if self.address is None:
self.address = "mongodb://%s/" % FLAGS.rawdata_cache_server_address
for _ in range(FLAGS.mongodb_connection_retry):
self.client = self._connect(self.address, lazy_connection)
if self.client is not None:
break
else:
logging.critical("Unable to reach the MongoDB server.")
评论列表
文章目录