1

我尝试使用 Python boto 库加载 AWS 图像列表。所以我的代码就像

con = boto.connect_ec2(user, pasw)
con.get_all_instances()
con.get_all_images()

问题是, get_all_instances() 工作正常,但 get_all_images() 没有响应。当从 kbd 停止应用程序时,我看到了

  File "eagle/main.py", line 102, in <module>
    main(sys.argv[1:])
  File "eagle/main.py", line 97, in main
    return request, process_request(request)
  File "eagle/main.py", line 45, in process_request
    request = each().process_request(request)
  File "/home/rustem/projects/eagle.2.0/eagle/../eagle/middlewares/standard.py", line 64, in process_request
    request.images = con.get_all_images()
  File "/home/rustem/envs/eagle.2.0/lib/python2.7/site-packages/boto/ec2/connection.py", line 171, in get_all_images
    [('item', Image)], verb='POST')
  File "/home/rustem/envs/eagle.2.0/lib/python2.7/site-packages/boto/connection.py", line 1063, in get_list
    body = response.read()
  File "/home/rustem/envs/eagle.2.0/lib/python2.7/site-packages/boto/connection.py", line 411, in read
    self._cached_response = httplib.HTTPResponse.read(self)
  File "/usr/lib64/python2.7/httplib.py", line 541, in read
    return self._read_chunked(amt)
  File "/usr/lib64/python2.7/httplib.py", line 590, in _read_chunked
    value.append(self._safe_read(chunk_left))
  File "/usr/lib64/python2.7/httplib.py", line 647, in _safe_read
    chunk = self.fp.read(min(amt, MAXAMOUNT))
  File "/usr/lib64/python2.7/socket.py", line 380, in read
    data = self._sock.recv(left)
  File "/usr/lib64/python2.7/ssl.py", line 241, in recv
    return self.read(buflen)
  File "/usr/lib64/python2.7/ssl.py", line 160, in read
    return self._sslobj.read(len)
KeyboardInterrupt

似乎 Boto 的功能不起作用,AWS API 没有响应。有没有人有类似的问题?谢谢。

4

1 回答 1

1

原因是 get_all_images 函数会返回来自 AWS 的所有图像,因此它可以工作大约几分钟。我开始使用过滤器,现在需要合理的时间。

于 2013-08-25T10:32:05.170 回答