如果芹菜在(显然)随机的基础上忘记任务,我该怎么办?

时间:2012-11-28 21:14:48

标签: redis celery celery-task

我有一个烧瓶应用程序,sqlalchemy和一个芹菜工人正在运行。我使用redis作为我的经纪人。每当有人在对话中提交新消息时,工作人员就会启动,并且应该向参与对话的所有人发送通知邮件。因此,它连接到数据库并获取所有相关的电子邮件地址。

不幸的是,似乎有一个随机因素决定,芹菜是否知道发送邮件的任务。在一些开始之后它完美地工作(有时),在一些开始后它根本不起作用。我得到的错误,当它不起作用时:

[2012-11-28 21:42:58,751: ERROR/MainProcess] Received unregistered task of type 'messages.sendnotifies'.
 The message has been ignored and discarded.

 Did you remember to import the module containing this task?
 Or maybe you are using relative imports?
 Please see http://bit.ly/gLye1c for more information.

 The full contents of the message body was:
 {'retries': 0, 'task': 'messages.sendnotifies', 'eta': None, 'args': [41L], 'expires': None, 'callbacks': None, 'errbacks': None, 'kwargs': {}, 'id': '47da3ba7-ec91-4056-bb4f-a6afec2f960f', 'utc': True} (183b)
 Traceback (most recent call last):
   File "/var/www/virtual/venv/lib/python2.7/site-packages/celery/worker/consumer.py", line 410, in on_task_received
     connection = self.connection
 KeyError: 'messages.sendnotifies'

当我使用--loglevel=DEBUG运行芹菜时,它会在任务列表中列出任务:

[Tasks]
   . celery.backend_cleanup
   . celery.chain
   . celery.chord
   . celery.chord_unlock
   . celery.chunks
   . celery.group
   . celery.map
   . celery.starmap
   . event.notfiy
   . messages.sendnotifies
   . money.checktransaction
   . money.deploypayment
   . money.invoicepromotion
   . protocols.plotweight
   . questionnaire.deploy
   . questionnaire.suitability
   . registration.notify
   . tracking.track
   . user.checkaccount
   . user.checkaccounts
   . user.fixpermissions
   . user.genpassreset

我无法确定一个系统,当它工作时,何时不工作。但我已将所有相关软件包升级到今天可用的最新版本,但它仍无效。

我希望有任何关于为什么这可能不起作用以及我如何能够解决它的想法。每个反馈都非常感谢,因为我有点绝望!

1 个答案:

答案 0 :(得分:0)

这可能是当前3.0开发中修复的错误,您可以帮助测试它 安装:

pip install https://github.com/celery/celery/zipball/3.0