当前位置: 首页>>代码示例>>Python>>正文


Python RemoteMachineShellConnection.log_command_output方法代码示例

本文整理汇总了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))
开发者ID:Boggypop,项目名称:testrunner,代码行数:10,代码来源:measure_sched_delays.py

示例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))
开发者ID:Boggypop,项目名称:testrunner,代码行数:37,代码来源:memcachetest_runner.py

示例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()
开发者ID:Boggypop,项目名称:testrunner,代码行数:19,代码来源:measure_sched_delays.py


注:本文中的lib.remote.remote_util.RemoteMachineShellConnection.log_command_output方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。