使用Fabric

时间:2018-01-19 07:01:58

标签: python amazon-web-services amazon-ec2 fabric

在某些自动化单元测试期间,我一直在使用Fabric在EC2实例上运行setup命令。这些测试运行好几个月,然后几天前,突然开始失败并出现错误:

Traceback (most recent call last):
  File "tests.py", line 207, in test_setup
    run('./setup_server')
  File "/usr/local/myproject/src/buildbot/worker3/myproject_runtests/build/.env/local/lib/python2.7/site-packages/fabric/network.py", line 682, in host_prompting_wrapper
    return func(*args, **kwargs)
  File "/usr/local/myproject/src/buildbot/worker3/myproject_runtests/build/.env/local/lib/python2.7/site-packages/fabric/operations.py", line 1091, in run
    shell_escape=shell_escape, capture_buffer_size=capture_buffer_size,
  File "/usr/local/myproject/src/buildbot/worker3/myproject_runtests/build/.env/local/lib/python2.7/site-packages/fabric/operations.py", line 934, in _run_command
    capture_buffer_size=capture_buffer_size)
  File "/usr/local/myproject/src/buildbot/worker3/myproject_runtests/build/.env/local/lib/python2.7/site-packages/fabric/operations.py", line 816, in _execute
    worker.raise_if_needed()
  File "/usr/local/myproject/src/buildbot/worker3/myproject_runtests/build/.env/local/lib/python2.7/site-packages/fabric/thread_handling.py", line 26, in raise_if_needed
    six.reraise(e[0], e[1], e[2])
  File "/usr/local/myproject/src/buildbot/worker3/myproject_runtests/build/.env/local/lib/python2.7/site-packages/fabric/thread_handling.py", line 13, in wrapper
    callable(*args, **kwargs)
  File "/usr/local/myproject/src/buildbot/worker3/myproject_runtests/build/.env/local/lib/python2.7/site-packages/fabric/io.py", line 31, in output_loop
    OutputLooper(*args, **kwargs).loop()
  File "/usr/local/myproject/src/buildbot/worker3/myproject_runtests/build/.env/local/lib/python2.7/site-packages/fabric/io.py", line 152, in loop
    self._flush(end_of_line + "\n")
  File "/usr/local/myproject/src/buildbot/worker3/myproject_runtests/build/.env/local/lib/python2.7/site-packages/fabric/io.py", line 57, in _flush
    self.stream.flush()
IOError: [Errno 32] Broken pipe

我正在运行的命令是pip install -r requirements.txt,它似乎运行得很好。如果我在本地运行测试,它会完成而不会出错。但是,每次在AWS上运行时,它都会失败一半。

这会导致什么?由于这是一个IOError,这些可能是由几乎任何类型的小网络中断引起的,我不确定如何诊断它。如果Fabric暂时失去连接,那可以解释它,但它无法解释为什么它是可重复的。我已经重新运行了这个脚本几十次,并且在最初完全连接到EC2实例后每次都失败了。

Fabric中是否有某种配置我可以改变以改善连接错误处理?

0 个答案:

没有答案