本文整理汇总了Python中lib.membase.api.rest_client.RestConnection.load_sample方法的典型用法代码示例。如果您正苦于以下问题:Python RestConnection.load_sample方法的具体用法?Python RestConnection.load_sample怎么用?Python RestConnection.load_sample使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.membase.api.rest_client.RestConnection
的用法示例。
在下文中一共展示了RestConnection.load_sample方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CBASBaseTest
# 需要导入模块: from lib.membase.api.rest_client import RestConnection [as 别名]
# 或者: from lib.membase.api.rest_client.RestConnection import load_sample [as 别名]
#.........这里部分代码省略.........
if not node:
self.fail("There is no node to add to cluster.")
if not services:
services = node.services.split(",")
otpnode = self.rest.add_node(user=node.rest_username,
password=node.rest_password,
remoteIp=node.ip,
port=8091,
services=services
)
if rebalance:
self.rebalance(wait_for_completion=wait_for_rebalance_completion)
return otpnode
def remove_node(self,otpnode=None, wait_for_rebalance=True):
nodes = self.rest.node_statuses()
'''This is the case when master node is running cbas service as well'''
if len(nodes) <= len(otpnode):
return
helper = RestHelper(self.rest)
try:
removed = helper.remove_nodes(knownNodes=[node.id for node in nodes],
ejectedNodes=[node.id for node in otpnode],
wait_for_rebalance=wait_for_rebalance)
except Exception as e:
self.sleep(5,"First time rebalance failed on Removal. Wait and try again. THIS IS A BUG.")
removed = helper.remove_nodes(knownNodes=[node.id for node in nodes],
ejectedNodes=[node.id for node in otpnode],
wait_for_rebalance=wait_for_rebalance)
if wait_for_rebalance:
self.assertTrue(removed, "Rebalance operation failed while removing %s,"%otpnode)
def load_sample_buckets(self, servers=None, bucketName=None, total_items=None):
""" Load the specified sample bucket in Couchbase """
self.assertTrue(self.rest.load_sample(bucketName),"Failure while loading sample bucket: %s"%bucketName)
""" check for load data into travel-sample bucket """
if total_items:
import time
end_time = time.time() + 600
while time.time() < end_time:
self.sleep(10)
num_actual = 0
if not servers:
num_actual = self.get_item_count(self.master,bucketName)
else:
for server in servers:
if "kv" in server.services:
num_actual += self.get_item_count(server,bucketName)
if int(num_actual) == total_items:
self.log.info("%s items are loaded in the %s bucket" %(num_actual,bucketName))
break
self.log.info("%s items are loaded in the %s bucket" %(num_actual,bucketName))
if int(num_actual) != total_items:
return False
else:
self.sleep(120)
return True
def create_bucket_on_cbas(self, cbas_bucket_name, cb_bucket_name,
cb_server_ip=None,
validate_error_msg=False,
username = None, password = None):
"""