本文整理汇总了Python中lib.membase.api.rest_client.RestConnection.diag_master_events方法的典型用法代码示例。如果您正苦于以下问题:Python RestConnection.diag_master_events方法的具体用法?Python RestConnection.diag_master_events怎么用?Python RestConnection.diag_master_events使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.membase.api.rest_client.RestConnection
的用法示例。
在下文中一共展示了RestConnection.diag_master_events方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PerfBase
# 需要导入模块: from lib.membase.api.rest_client import RestConnection [as 别名]
# 或者: from lib.membase.api.rest_client.RestConnection import diag_master_events [as 别名]
#.........这里部分代码省略.........
self.assertTrue(status)
def delayed_rebalance_worker(self, servers, num_nodes, delay_seconds, sc,
max_retries=PerfDefaults.reb_max_retries,
reb_mode=PerfDefaults.REB_MODE.IN):
time.sleep(delay_seconds)
gmt_now = time.strftime(PerfDefaults.strftime, time.gmtime())
self.log.info("rebalance started")
if not sc:
self.log.error("invalid stats collector")
return
status = False
retries = 0
while not status and retries <= max_retries:
start_time = time.time()
if reb_mode == PerfDefaults.REB_MODE.OUT:
status, nodes = RebalanceHelper.rebalance_out(servers, num_nodes)
elif reb_mode == PerfDefaults.REB_MODE.SWAP:
status, nodes = RebalanceHelper.rebalance_swap(servers, num_nodes)
else:
status, nodes = RebalanceHelper.rebalance_in(servers,
num_nodes - 1, do_check=(not retries))
end_time = time.time()
self.log.info("status: {0}, nodes: {1}, retries: {2}"
.format(status, nodes, retries))
if not status:
retries += 1
time.sleep(delay_seconds)
sc.reb_stats(start_time, end_time - start_time)
if self.parami("master_events", PerfDefaults.master_events):
filename = "master_events.log"
with open(filename, "w") as f:
f.write(self.rest.diag_master_events()[1])
def delayed_rebalance(self, num_nodes, delay_seconds=10,
max_retries=PerfDefaults.reb_max_retries,
reb_mode=0, sync=False):
self.log.info("delayed_rebalance")
if sync:
PerfBase.delayed_rebalance_worker(self, self.input.servers,
num_nodes, delay_seconds, self.sc, max_retries, reb_mode)
else:
t = threading.Thread(target=PerfBase.delayed_rebalance_worker,
args=(self, self.input.servers, num_nodes,
delay_seconds, self.sc, max_retries, reb_mode))
t.daemon = True
t.start()
@staticmethod
def set_auto_compaction(server, parallel_compaction, percent_threshold):
rest = RestConnection(server)
rest.set_auto_compaction(parallel_compaction,
dbFragmentThresholdPercentage=percent_threshold,
viewFragmntThresholdPercentage=percent_threshold)
@staticmethod
def delayed_compaction_worker(servers, parallel_compaction,
percent_threshold, delay_seconds):
time.sleep(delay_seconds)
PerfBase.set_auto_compaction(servers[0], parallel_compaction,
percent_threshold)
def delayed_compaction(self, parallel_compaction="false",
percent_threshold=0.01,
delay_seconds=10):