Permalink
Browse files

don't use zmq.select due to bug in pyzmq 2.1.7

pyzmq's zmq.select timeout has the wrong units in 2.1.7, resulting in a timeout of 1 waiting for 1000s before raising. Use zmq.Poller instead, which doesn't have this bug.
  • Loading branch information...
1 parent 9cb5aa8 commit 11443881095d382c88b60fb74c8e85530cb679d3 @minrk minrk committed Jun 22, 2011
Showing with 6 additions and 2 deletions.
  1. +6 −2 IPython/parallel/client/client.py
View
8 IPython/parallel/client/client.py
@@ -457,8 +457,12 @@ def connect_socket(s, url):
return s.connect(url)
self.session.send(self._query_socket, 'connection_request')
- r,w,x = zmq.select([self._query_socket],[],[], timeout)
- if not r:
+ # use Poller because zmq.select has wrong units in pyzmq 2.1.7
+ poller = zmq.Poller()
+ poller.register(self._query_socket, zmq.POLLIN)
+ # poll expects milliseconds, timeout is seconds
+ evts = poller.poll(timeout*1000)
+ if not evts:
raise error.TimeoutError("Hub connection request timed out")
idents,msg = self.session.recv(self._query_socket,mode=0)
if self.debug:

0 comments on commit 1144388

Please sign in to comment.