I am using tornado.ioloop
inside celery
worker because I need to use mongodb.
class WorkerBase():
@gen.engine
def foo(self,args,callback)
bar = ['Python','Celery','Javascript','HTML']
# ... process something ....
callback(bar)
@gen.engine
def RunMyTask(self,args):
result = yield gen.Task(self.foo,args=args)
# Stop IOLoop instance
IOLoop.instance().stop()
@task(name="MyWorker",base=WorkerBase)
def CeleryWorker(args):
# This works because i'm adding base as WorkerBase
CeleryWorker.RunMyTask(args)
IOLoop.instance().start()
return True
When I am invoking a task it gives an error saying:
[2014-10-02 12:12:11,561: ERROR/Worker-4] Exception in callback None
Traceback (most recent call last):
File "/var/www/myapp/env/local/lib/python2.7/site-packages/tornado/ioloop.py", line 832, in start
fd_obj, handler_func = self._handlers[fd]
KeyError: 16
or
[2014-10-02 12:12:11,561: ERROR/Worker-4] Exception in callback None
Traceback (most recent call last):
File "/var/www/myapp/env/local/lib/python2.7/site-packages/tornado/ioloop.py", line 832, in start
fd_obj, handler_func = self._handlers[fd]
KeyError: 14
These errors are not consistent. Is there any raise condition?