example of scheduling

This commit is contained in:
Davide Alberani 2018-01-16 23:10:03 +01:00
parent 84cdfac30d
commit 7bfe80fac7

View file

@ -98,10 +98,18 @@ class TemplateHandler(BaseHandler):
self.render(page, **self.arguments) self.render(page, **self.arguments)
def run_scheduled(id_=None, *args, **kwargs):
print('RUNNING %d' % id_)
def run():
print('runno!')
def serve(): def serve():
jobstores = {'default': SQLAlchemyJobStore(url=JOBS_STORE)} jobstores = {'default': SQLAlchemyJobStore(url=JOBS_STORE)}
scheduler = TornadoScheduler(jobstores=jobstores) scheduler = TornadoScheduler(jobstores=jobstores)
scheduler.start() scheduler.start()
scheduler.remove_job('run')
#scheduler.add_job(run, 'interval', minutes=1)
define("port", default=3210, help="run on the given port", type=int) define("port", default=3210, help="run on the given port", type=int)
define("address", default='', help="bind the server at the given address", type=str) define("address", default='', help="bind the server at the given address", type=str)