https://github.com/mher/tornado-celery lets you name Celery tasks from Tornado
from tornado import gen, web
import tcelery, tasks
tcelery.setup_nonblocking_producer()
class AsyncHandler(web.RequestHandler):
@asynchronous
def get(self):
tasks.echo.apply_async(args=['Hello world!'], callback=self.on_result)
def on_result(self, response):
self.write(str(response.result))
self.finish()
source
share