5

我正在尝试运行内存中的任务。在工人上注册的任务

[2012-09-13 11:10:18,928: WARNING/PoolWorker-1] [u'B.run', u'M1.run', u'M11.run', u'M22.run', u'M23.run', u'M24.run', u'M25.run', u'M26.run', u'M4.run', u'celery.backend_cleanup', u'celery.chain', u'celery.chord', u'celery.chord_unlock', u'celery.chunks', u'celery.group', u'celery.map', u'celery.starmap', u'impmod.run', u'initializerNew.run']

但它仍然给出错误:

[2012-09-13 11:19:59,848: ERROR/MainProcess] Received unregistered task of type 'M24.run'.
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': 'M24.run', 'eta': None, 'args': [{'cnt': '3', 'ids': '0001-0004,0002-0004', 'NagID': 2, 'wgt': '3', 'ModID': 'M24', 'ProfileModuleID': 64, 'mhs': '1'}, 0], 'expires': None, 'callbacks': None, 'errbacks': None, 'kwargs': {}, 'id': 'ddf5f520-803b-4dc9-ad3b-a931d90950a6', 'utc': True} (394b)

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/celery-3.0.4-py2.7.egg/celery/worker/consumer.py", line 410, in on_task_received
    strategies[name](message, body, message.ack_log_error)
KeyError: 'M24.run'
4

1 回答 1

0

你能附上启动芹菜的命令吗?看起来这个应用程序有不同的 sys.path,这就是 celery 应用程序无法导入“M24.run”任务的原因。

您还应该记住,Celery 需要在您的任务所在的位置设置模块名称。

类似的东西

CELERY_INCLUDE = [
    'M24',
]
于 2013-04-15T04:39:29.360 回答