本文整理汇总了Python中membase.api.rest_client.RestConnection.set_view_info方法的典型用法代码示例。如果您正苦于以下问题:Python RestConnection.set_view_info方法的具体用法?Python RestConnection.set_view_info怎么用?Python RestConnection.set_view_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类membase.api.rest_client.RestConnection
的用法示例。
在下文中一共展示了RestConnection.set_view_info方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_compaction_details
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import set_view_info [as 别名]
def _get_compaction_details(self):
rest = RestConnection(self.server)
status, content = rest.set_view_info(self.bucket, self.design_doc_name)
curr_no_of_compactions = content["stats"]["compactions"]
curr_ddoc_fragemtation = \
MonitorViewFragmentationTask.calc_ddoc_fragmentation(rest, self.design_doc_name, self.bucket)
return (curr_no_of_compactions, curr_ddoc_fragemtation)
示例2: test_views_time_compaction
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import set_view_info [as 别名]
def test_views_time_compaction(self):
rest = RestConnection(self.master)
currTime = datetime.datetime.now()
fromTime = currTime + datetime.timedelta(hours=1)
toTime = currTime + datetime.timedelta(hours=12)
self.set_auto_compaction(rest, viewFragmntThresholdPercentage=self.fragmentation_value, allowedTimePeriodFromHour=fromTime.hour,
allowedTimePeriodFromMin=fromTime.minute, allowedTimePeriodToHour=toTime.hour, allowedTimePeriodToMin=toTime.minute,
allowedTimePeriodAbort="false")
self.make_ddocs(self.ddocs_num, self.view_per_ddoc)
self.create_ddocs()
self._load_all_buckets(self.master, self.gen_load, "create", 0)
self._monitor_view_fragmentation()
currTime = datetime.datetime.now()
#Need to make it configurable
newTime = currTime + datetime.timedelta(minutes=5)
self.set_auto_compaction(rest, viewFragmntThresholdPercentage=self.fragmentation_value, allowedTimePeriodFromHour=currTime.hour,
allowedTimePeriodFromMin=currTime.minute, allowedTimePeriodToHour=newTime.hour, allowedTimePeriodToMin=newTime.minute,
allowedTimePeriodAbort="false")
for ddoc in self.ddocs:
status, content = rest.set_view_info(self.default_bucket_name, ddoc.name)
curr_no_of_compactions = content["stats"]["compactions"]
self.log.info("Current number of compactions is {0}".format(curr_no_of_compactions))
compaction_tasks = []
for ddoc in self.ddocs:
compaction_tasks.append(self.cluster.async_monitor_compact_view(self.master, ddoc.name, frag_value=self.fragmentation_value))
for task in compaction_tasks:
task.result()
示例3: aggregate_ddoc_info
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import set_view_info [as 别名]
def aggregate_ddoc_info(rest, design_doc_name, bucket = "default"):
nodes = rest.node_statuses()
info = []
for node in nodes:
server_info = {"ip" : node.ip,
"port" : node.port,
"username" : rest.username,
"password" : rest.password}
rest = RestConnection(server_info)
status, content = rest.set_view_info(bucket, design_doc_name)
if status:
info.append(content)
return info
示例4: collect_indexing_stats
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import set_view_info [as 别名]
def collect_indexing_stats(self, nodes, bucket, ddoc, frequency):
"""Collect view indexing stats"""
self._task['view_info'] = list()
while not self._aborted():
time.sleep(frequency)
print "Collecting view indexing stats"
for node in nodes:
rest = RestConnection(node)
data = rest.set_view_info(bucket, ddoc)
update_history = data[1]['stats']['update_history']
try:
indexing_time = \
[event['indexing_time'] for event in update_history]
avg_time = sum(indexing_time) / len(indexing_time)
except (IndexError, KeyError):
avg_time = 0
finally:
self._task['view_info'].append({'node': node.ip,
'indexing_time': avg_time,
'timestamp': time.time()})
print "Finished collecting view indexing stats"
示例5: _is_compacting
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import set_view_info [as 别名]
def _is_compacting(self):
rest = RestConnection(self.server)
status, content = rest.set_view_info(self.bucket, self.design_doc_name)
return content["compact_running"] == "true"