stop using deprecated DelayedCallback

in favor of simpler IOLoop.add_timeout

It was added in pyzmq, but deprecated in pyzmq-13.
pull/37/head
MinRK 12 years ago
parent ed43a196b4
commit ee1d9d65f3

@ -17,10 +17,9 @@ Authors:
#-----------------------------------------------------------------------------
from tornado import web
from zmq.eventloop import ioloop
from IPython.config.configurable import LoggingConfigurable
from IPython.utils.traitlets import Dict, Instance, CFloat
from IPython.utils.traitlets import Dict, Instance, Float
from IPython.core.profileapp import list_profiles_in
from IPython.core.profiledir import ProfileDir
from IPython.utils import py3compat
@ -38,7 +37,7 @@ class ClusterManager(LoggingConfigurable):
profiles = Dict()
delay = CFloat(1., config=True,
delay = Float(1., config=True,
help="delay (in s) between starting the controller and the engines")
loop = Instance('zmq.eventloop.ioloop.IOLoop')
@ -133,11 +132,13 @@ class ClusterManager(LoggingConfigurable):
esl.stop()
clean_data()
cl.on_stop(controller_stopped)
dc = ioloop.DelayedCallback(lambda: cl.start(), 0, self.loop)
dc.start()
dc = ioloop.DelayedCallback(lambda: esl.start(n), 1000*self.delay, self.loop)
dc.start()
loop = self.loop
def start():
"""start the controller, then the engines after a delay"""
cl.start()
loop.add_timeout(self.loop.time() + self.delay, lambda : esl.start(n))
self.loop.add_callback(start)
self.log.debug('Cluster started')
data['controller_launcher'] = cl

Loading…
Cancel
Save