擅长:python、mysql、java
<p>我的解决方案包括从龙卷风到芹菜的投票:</p>
<pre><code>class CeleryHandler(tornado.web.RequestHandlerr):
@tornado.web.asynchronous
def get(self):
task = yourCeleryTask.delay(**kwargs)
def check_celery_task():
if task.ready():
self.write({'success':True} )
self.set_header("Content-Type", "application/json")
self.finish()
else:
tornado.ioloop.IOLoop.instance().add_timeout(datetime.timedelta(0.00001), check_celery_task)
tornado.ioloop.IOLoop.instance().add_timeout(datetime.timedelta(0.00001), check_celery_task)
</code></pre>
<p>这是关于它的<a href="http://web.archive.org/web/20130408150740/http://hymloth.posterous.com/bringing-celery-and-tornado-together">post</a>。</p>