本文整理汇总了Python中lib.membase.api.rest_client.RestConnection.get_database_disk_size方法的典型用法代码示例。如果您正苦于以下问题:Python RestConnection.get_database_disk_size方法的具体用法?Python RestConnection.get_database_disk_size怎么用?Python RestConnection.get_database_disk_size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.membase.api.rest_client.RestConnection
的用法示例。
在下文中一共展示了RestConnection.get_database_disk_size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_bucket_size
# 需要导入模块: from lib.membase.api.rest_client import RestConnection [as 别名]
# 或者: from lib.membase.api.rest_client.RestConnection import get_database_disk_size [as 别名]
def get_bucket_size(self, interval=60):
self._task["bucket_size"] = []
retries = 0
nodes_iterator = (node for node in self.nodes)
node = nodes_iterator.next()
rest = RestConnection(node)
while not self._aborted():
time.sleep(interval)
log.info("collecting bucket size stats")
try:
status, db_size = rest.get_database_disk_size(self.bucket)
if status:
self._task["bucket_size"].append(db_size)
except IndexError, e:
retries += 1
log.error("unable to get bucket size {0}: {1}"
.format(self.bucket, e))
log.warning("retries: {0} of {1}".format(retries, RETRIES))
if retries == RETRIES:
try:
node = nodes_iterator.next()
rest = RestConnection(node)
retries = 0
except StopIteration:
log.error("no nodes available: stop collecting bucket_size")
return