Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/350.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用pssh.clients时,Python并行ssh run_命令不会超时_Python_Parallel Ssh - Fatal编程技术网

使用pssh.clients时,Python并行ssh run_命令不会超时

使用pssh.clients时,Python并行ssh run_命令不会超时,python,parallel-ssh,Python,Parallel Ssh,我有以下代码: from pssh.clients import ParallelSSHClient #------------------------------------------------- hosts = [ IP1, IP2, ... IPn] host_config = { dict containing userid & passwd for each host } clients = ParallelSSHClient(hosts, host_config=ho

我有以下代码:

from pssh.clients import ParallelSSHClient
#-------------------------------------------------

hosts = [ IP1, IP2, ... IPn]
host_config = { dict containing userid & passwd for each host }

clients = ParallelSSHClient(hosts, host_config=host_config,
                           num_retries=1, timeout=3)

output = clients.run_command("ls", stop_on_errors=False, timeout=3)
print output
如果我的主机拥有所有有效IP,那么我将获得“输出”。但是,如果其中一个IP无效(不存在主机),则run_命令将永远挂起。甚至尝试使用“use_pty=True”参数来运行_命令

奇怪的是,如果我使用不推荐的方法pssh_client而不是clients,如下所示:

from pssh.pssh_client import ParallelSSHClient

它按预期超时。要么是新的导入方法引入了一个bug,要么是有了一些新的方法来正确指定超时。我宁愿使用推荐的方式,而不是不推荐的方式。但推荐的方法对我不起作用。有人知道我是不是做错了什么吗

这已被确认为ParallelSSH的github站点上的一个bug。因此,这个问题已经结束。发行日期如下:


在项目的bug跟踪器中将其报告为bug:他们已将其视为有效bug。感谢John提供的发布错误的链接。请在这里发布错误的链接,也许在您的答案中。