Reputation: 1242
What is the best way (pattern) to create scheduler with Periodic Callback in tornado: execute scheduled job in specific datetime
Upvotes: 2
Views: 5976
Reputation: 1964
You should use a PeriodicCallback
class tornado.ioloop.PeriodicCallback(callback, callback_time, io_loop=None)
Schedules the given callback to be called periodically. The callback is called every callback_time milliseconds.
From: Tornado Callbacks
Upvotes: 6
Reputation: 3266
This links may be useful:
Basically you can use the add_timeout
method of the current ioloop
instance like this:
# Schedule callback to be executed 5 seconds from now
ioloop.IOLoop.instance().add_timeout(time.time() + 5, callback)
Hope it helps.
Upvotes: 3