本文整理汇总了Python中lib.remote.remote_util.RemoteMachineShellConnection.log_command_output方法的典型用法代码示例。如果您正苦于以下问题:Python RemoteMachineShellConnection.log_command_output方法的具体用法?Python RemoteMachineShellConnection.log_command_output怎么用?Python RemoteMachineShellConnection.log_command_output使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.remote.remote_util.RemoteMachineShellConnection
的用法示例。
在下文中一共展示了RemoteMachineShellConnection.log_command_output方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: stop_measure_sched_delay
# 需要导入模块: from lib.remote.remote_util import RemoteMachineShellConnection [as 别名]
# 或者: from lib.remote.remote_util.RemoteMachineShellConnection import log_command_output [as 别名]
def stop_measure_sched_delay(self):
for server in self.servers:
shell = RemoteMachineShellConnection(server)
cmd = "killall -9 -r .*measure-sched-delays"
output, error = shell.execute_command(cmd)
shell.log_command_output(output, error)
shell.disconnect()
self.log.info("measure-sched-delays was stopped on {0}".format(server.ip))
示例2: MemcachetestRunner
# 需要导入模块: from lib.remote.remote_util import RemoteMachineShellConnection [as 别名]
# 或者: from lib.remote.remote_util.RemoteMachineShellConnection import log_command_output [as 别名]
class MemcachetestRunner():
def __init__(self, server, path="/tmp/", memcached_ip="localhost", memcached_port="11211", num_items=100000, extra_params=""):
self.server = server
self.shell = RemoteMachineShellConnection(self.server)
self.path = path
self.memcached_ip = memcached_ip
self.memcached_port = memcached_port
self.num_items = num_items
self.extra_params = extra_params
self.log = logger.Logger.get_logger()
def start_memcachetest(self):
#check that memcachetest already installed
exists = self.shell.file_exists('/usr/local/bin/', 'memcachetest')
if not exists:
#try to get from git and install
output, error = self.shell.execute_command_raw("cd {0}; git clone git://github.com/membase/memcachetest.git".format(self.path))
self.shell.log_command_output(output, error)
output, error = self.shell.execute_command_raw("cd {0}/memcachetest; ./config/autorun.sh && ./configure && make install".format(self.path))
self.shell.log_command_output(output, error)
else:
self.log.info("memcachetest already set on {0}:/usr/local/bin/memcachetest".format(self.server.ip, self.path))
self.stop_memcachetest()
return self.launch_memcachetest()
def launch_memcachetest(self):
command = "{0}/memcachetest/memcachetest -h {1}:{2} -i {3} {4}".format(self.path, self.memcached_ip, self.memcached_port, self.num_items, self.extra_params)
output, error = self.shell.execute_command_raw(command)
status = self.shell.log_command_output(output, error, track_words="downstream timeout")
def stop_memcachetest(self):
cmd = "killall memcachetest"
output, error = self.shell.execute_command(cmd)
self.shell.log_command_output(output, error)
self.log.info("memcachetest was stopped on {0}".format(self.server.ip))
示例3: start_measure_sched_delays
# 需要导入模块: from lib.remote.remote_util import RemoteMachineShellConnection [as 别名]
# 或者: from lib.remote.remote_util.RemoteMachineShellConnection import log_command_output [as 别名]
def start_measure_sched_delays(self):
for server in self.servers:
shell = RemoteMachineShellConnection(server)
exists = shell.file_exists(self.path, 'measure-sched-delays')
if not exists:
shell.copy_file_local_to_remote("resources/linux/measure-sched-delays.tar.gz", "{0}.tar.gz".format(self.path))
output, error = shell.execute_command_raw("cd /tmp/; tar -xvzf measure-sched-delays.tar.gz")
shell.log_command_output(output, error)
output, error = shell.execute_command_raw("cd {0}; ./configure; make".format(self.path))
shell.log_command_output(output, error)
else:
self.log.info("measure-sched-delays already deployed on {0}:{1}".format(server.ip, self.path))
self.stop_measure_sched_delay()
output, error = shell.execute_command_raw("rm -rf {0}/sched-delay*".format(self.path))
shell.log_command_output(output, error)
self.launch_measure_sched_delay(shell, file="sched-delay-{0}".format(server.ip))
shell.disconnect()