2013-07-06 60 views
1

有时候,而我的布脚本运行的基本运行在远程机器上的几个命令,我会遇到这样的错误:面料插座例外:连接超时

ERROR:paramiko.transport:Socket exception: Connection timed out (110) 
!!! Parallel execution exception under host 'xyz' 
.... 
....  (several logs here) 
error: [Errno 110] Connection timed out 

我的代码是这样的:

with settings(....): 
    execute(tasks,...) 

有没有一种方法可以让织物在遇到这种超时时重试旧命令而不是跳过它,例如在上述设置中可以选择重试?

回答

0

使用Fabric 1.4+,请使用参数env.connection_attempts或命令行上的类似标志。

Multiple connection attempts and skipping bad hosts

As of Fabric 1.4, multiple attempts may be made to connect to remote servers before aborting with an error: Fabric will try connecting env.connection_attempts times before giving up, with a timeout of env.timeout seconds each time. (These currently default to 1 try and 10 seconds, to match previous behavior, but they may be safely changed to whatever you need.)

http://docs.fabfile.org/en/latest/usage/execution.html#multiple-connection-attempts-and-skipping-bad-hosts