任务不适用于芹菜

时间:2018-06-21 14:31:28

标签: python django celery

请帮助我了解如何在芹菜上注册任务。

错误日志为:

[2018-06-21 23:23:20,288: ERROR/MainProcess] Received unregistered task of type 'projects.tasks.hoge'.
The message has been ignored and discarded.

Did you remember to import the module containing this task?
Or maybe you're using relative imports?

Please see
http://docs.celeryq.org/en/latest/internals/protocol.html
for more information.

The full contents of the message body was:
b'[[2, true], {}, {"callbacks": null, "errbacks": null, "chain": null, "chord": null}]' (84b)
Traceback (most recent call last):
  File "/home/ec2-user/.pyenv/versions/3.6.2/lib/python3.6/site-packages/celery/worker/consumer/consumer.py", line 561, in on_task_received
    strategy = strategies[type_]
KeyError: 'project.tasks.hoge'

在不同的环境和相同的源代码上都可以正常工作。

有人知道为什么会这样吗?

0 个答案:

没有答案