2013-10-16 1 views
0

원격 API에서 데이터 검색의 병렬 처리를 시도하고 있습니다. 원격 API에는 대용량 기능이 없으므로 필요한 각각의 객체에 대해 별도의 GET 요청을 만들어야합니다.요청으로 gevent/greenlets를 사용할 때 ServerNotFoundError 받기

나는 gevent를 믹스에 추가했습니다. 때로는 잘 작동하지만 다시 동일한 요청을 시도하면 100 개 중 50 개가 다음과 같이 실패합니다.

Traceback (most recent call last): 
    ... 
    File "/Users/---/venv/lib/python2.7/site-packages/httplib2/__init__.py", line 1570, in request 
    (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey) 
    File "/Users/---/venv/lib/python2.7/site-packages/httplib2/__init__.py", line 1317, in _request 
    (response, content) = self._conn_request(conn, request_uri, method, body, headers) 
    File "/Users/---/venv/lib/python2.7/site-packages/httplib2/__init__.py", line 1258, in _conn_request 
    raise ServerNotFoundError("Unable to find the server at %s" % conn.host) 
ServerNotFoundError: Unable to find the server at my.remote.host 

<Greenlet at 0x10c6eacd0: function_name(<Object1>, <Object2>, u'zebra', True)> failed with ServerNotFoundError 

해결 방법에 대한 의견이 있으십니까? 너무 많은 요청이 너무 빨리 발생 했습니까? 그렇다면, 그린렛의 수를 줄이는 쉬운 방법이 있습니까?

답변

0

Gevent는이 질문의 일부로 부주의하고 잘못 태그 지정 된 python 요청과 관련된 일부 DNS 문제를 일으키는 것으로 알려져 있습니다. 다행히 당신을 위해, 우리가 전에이 문제를 염두에두고 그렇게

gevent.dns.resolve_ipv4('example.com') 
# However you make your httplib2 call. 

같은 사용자 resolved it을 본 다른 사용자가이 may already be fixed in a new version of gevent 지적했다.

위의 스 니펫이 효과가있는 경우 geent를 업그레이드하여 문제가 없는지 확인해야합니다.

관련 문제