2013-07-06 90 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