本文整理汇总了Python中lib.remote.remote_util.RemoteMachineShellConnection.flush_os_caches方法的典型用法代码示例。如果您正苦于以下问题:Python RemoteMachineShellConnection.flush_os_caches方法的具体用法?Python RemoteMachineShellConnection.flush_os_caches怎么用?Python RemoteMachineShellConnection.flush_os_caches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.remote.remote_util.RemoteMachineShellConnection
的用法示例。
在下文中一共展示了RemoteMachineShellConnection.flush_os_caches方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: warmup
# 需要导入模块: from lib.remote.remote_util import RemoteMachineShellConnection [as 别名]
# 或者: from lib.remote.remote_util.RemoteMachineShellConnection import flush_os_caches [as 别名]
def warmup(self, collect_stats=True, flush_os_cache=False):
"""
Restart cluster and wait for it to warm up.
In current version, affect the master node only.
"""
if not self.input.servers:
print "[warmup error] empty server list"
return
if collect_stats:
client_id = self.parami("prefix", 0)
test_params = {'test_time': time.time(),
'test_name': self.id(),
'json': 0}
sc = self.start_stats(self.spec_reference + ".warmup",
test_params=test_params,
client_id=client_id)
print "[warmup] preparing to warmup cluster ..."
server = self.input.servers[0]
shell = RemoteMachineShellConnection(server)
start_time = time.time()
print "[warmup] stopping couchbase ... ({0}, {1})"\
.format(server.ip, time.strftime(PerfDefaults.strftime))
shell.stop_couchbase()
print "[warmup] couchbase stopped ({0}, {1})"\
.format(server.ip, time.strftime(PerfDefaults.strftime))
if flush_os_cache:
print "[warmup] flushing os cache ..."
shell.flush_os_caches()
shell.start_couchbase()
print "[warmup] couchbase restarted ({0}, {1})"\
.format(server.ip, time.strftime(PerfDefaults.strftime))
self.wait_until_warmed_up()
print "[warmup] warmup finished"
end_time = time.time()
ops = {'tot-sets': 0,
'tot-gets': 0,
'tot-items': 0,
'tot-creates': 0,
'tot-misses': 0,
"start-time": start_time,
"end-time": end_time}
if collect_stats:
self.end_stats(sc, ops, self.spec_reference + ".warmup")