Show More
@@ -103,6 +103,7 b' def skip_without(*names):' | |||||
103 |
|
103 | |||
104 |
|
104 | |||
105 | class ClusterTestCase(BaseZMQTestCase): |
|
105 | class ClusterTestCase(BaseZMQTestCase): | |
|
106 | timeout = 10 | |||
106 |
|
107 | |||
107 | def add_engines(self, n=1, block=True): |
|
108 | def add_engines(self, n=1, block=True): | |
108 | """add multiple engines to our cluster""" |
|
109 | """add multiple engines to our cluster""" | |
@@ -126,9 +127,17 b' class ClusterTestCase(BaseZMQTestCase):' | |||||
126 |
|
127 | |||
127 | assert not len(self.client.ids) < n, "waiting for engines timed out" |
|
128 | assert not len(self.client.ids) < n, "waiting for engines timed out" | |
128 |
|
129 | |||
|
130 | def client_wait(self, client, jobs=None, timeout=-1): | |||
|
131 | """my wait wrapper, sets a default finite timeout to avoid hangs""" | |||
|
132 | if timeout < 0: | |||
|
133 | timeout = self.timeout | |||
|
134 | return Client.wait(client, jobs, timeout) | |||
|
135 | ||||
129 | def connect_client(self): |
|
136 | def connect_client(self): | |
130 | """connect a client with my Context, and track its sockets for cleanup""" |
|
137 | """connect a client with my Context, and track its sockets for cleanup""" | |
131 | c = Client(profile='iptest', context=self.context) |
|
138 | c = Client(profile='iptest', context=self.context) | |
|
139 | c.wait = lambda *a, **kw: self.client_wait(c, *a, **kw) | |||
|
140 | ||||
132 | for name in filter(lambda n:n.endswith('socket'), dir(c)): |
|
141 | for name in filter(lambda n:n.endswith('socket'), dir(c)): | |
133 | s = getattr(c, name) |
|
142 | s = getattr(c, name) | |
134 | s.setsockopt(zmq.LINGER, 0) |
|
143 | s.setsockopt(zmq.LINGER, 0) |
General Comments 0
You need to be logged in to leave comments.
Login now