Show More
@@ -212,6 +212,17 b' class HubFactory(RegistrationFactory):' | |||||
212 |
|
212 | |||
213 | """) |
|
213 | """) | |
214 |
|
214 | |||
|
215 | registration_timeout = Integer(0, config=True, | |||
|
216 | help="Engine registration timeout in seconds [default: max(30," | |||
|
217 | "10*heartmonitor.period)]" ) | |||
|
218 | ||||
|
219 | def _registration_timeout_default(self): | |||
|
220 | if self.heartmonitor is None: | |||
|
221 | # early initialization, this value will be ignored | |||
|
222 | return 0 | |||
|
223 | # heartmonitor period is in milliseconds, so 10x in seconds is .01 | |||
|
224 | return max(30, int(.01 * self.heartmonitor.period)) | |||
|
225 | ||||
215 | # not configurable |
|
226 | # not configurable | |
216 | db = Instance('IPython.parallel.controller.dictdb.BaseDB') |
|
227 | db = Instance('IPython.parallel.controller.dictdb.BaseDB') | |
217 | heartmonitor = Instance('IPython.parallel.controller.heartmonitor.HeartMonitor') |
|
228 | heartmonitor = Instance('IPython.parallel.controller.heartmonitor.HeartMonitor') | |
@@ -337,10 +348,13 b' class HubFactory(RegistrationFactory):' | |||||
337 | url = util.disambiguate_url(self.client_url('task')) |
|
348 | url = util.disambiguate_url(self.client_url('task')) | |
338 | r.connect(url) |
|
349 | r.connect(url) | |
339 |
|
350 | |||
|
351 | # convert seconds to msec | |||
|
352 | registration_timeout = 1000*self.registration_timeout | |||
|
353 | ||||
340 | self.hub = Hub(loop=loop, session=self.session, monitor=sub, heartmonitor=self.heartmonitor, |
|
354 | self.hub = Hub(loop=loop, session=self.session, monitor=sub, heartmonitor=self.heartmonitor, | |
341 | query=q, notifier=n, resubmit=r, db=self.db, |
|
355 | query=q, notifier=n, resubmit=r, db=self.db, | |
342 | engine_info=self.engine_info, client_info=self.client_info, |
|
356 | engine_info=self.engine_info, client_info=self.client_info, | |
343 | log=self.log) |
|
357 | log=self.log, registration_timeout=registration_timeout) | |
344 |
|
358 | |||
345 |
|
359 | |||
346 | class Hub(SessionFactory): |
|
360 | class Hub(SessionFactory): | |
@@ -410,7 +424,6 b' class Hub(SessionFactory):' | |||||
410 | """ |
|
424 | """ | |
411 |
|
425 | |||
412 | super(Hub, self).__init__(**kwargs) |
|
426 | super(Hub, self).__init__(**kwargs) | |
413 | self.registration_timeout = max(10000, 5*self.heartmonitor.period) |
|
|||
414 |
|
427 | |||
415 | # register our callbacks |
|
428 | # register our callbacks | |
416 | self.query.on_recv(self.dispatch_query) |
|
429 | self.query.on_recv(self.dispatch_query) |
General Comments 0
You need to be logged in to leave comments.
Login now