简体   繁体   English

Celery未注册的任务KeyError

[英]Celery unregistered task KeyError

I start the worker by executing the following in the terminal: 我通过在终端中执行以下操作来启动worker:

celery -A cel_test  worker --loglevel=INFO --concurrency=10 -n worker1.%h

Then I get a long looping error message stating that celery has received an unregistered task and has triggered: 然后我收到一条长循环错误消息,指出芹菜已收到未注册的任务并触发:

KeyError: 'cel_test.grp_all_w_codes.mk_dct' #this is the name of the task

The problem with this is that cel_test.grp_all_w_codes.mk_dct doesn't exist. 这个问题是cel_test.grp_all_w_codes.mk_dct不存在。 In fact there isn't even a module cel_test.grp_all_w_codes let alone the task mk_dct . 实际上甚至没有模块cel_test.grp_all_w_codes更不用说任务mk_dct There was once a few days ago but I've since deleted it. 几天前有一次,但我已经删除了它。 I thought maybe there was a .pyc file floating around but there isn't. 我想也许有一个.pyc文件漂浮,但没有。 I also can't find a single reference in my code to the task that's throwing the error. 我也无法在我的代码中找到引发错误的任务的单个引用。 I shut down my computer and restarted the rabbitmq server thinking maybe a reference to something was just stuck in memory but it did not help. 我关闭了我的电脑并重新启动了rabbitmq服务器,认为可能引用某些内容只是卡在内存中但它没有帮助。

Does anyone have any idea what could be the problem here or what I'm missing? 有谁知道这里可能出现什么问题或者我缺少什么?

Well, without knowing your conf files, I can see two reasons that would provoke this: 好吧,在不知道你的conf文件的情况下,我可以看到两个会引起这种情况的原因:

  • the mk_dct task wasn't completed when you stopped the worker and delete the module. 停止工作并删除模块时, mk_dct任务未完成。 If you're running with CELERY_ACKS_LATE , it will try to relaunch the task everytime you re run the worker. 如果您使用CELERY_ACKS_LATE运行,则每次重新运行worker时都会尝试重新启动任务。 Try remove this setting, or launch the worker with the purge option. 尝试删除此设置,或使用purge选项启动worker

celery -A cel_test worker --loglevel=INFO --concurrency=10 -n worker1.%h --purge

  • the mk_dct task is launched by your celery beat. mk_dct任务是由你的芹菜击败发起的。 If so, try relaunching celery beat and clearing it's database backend if you had a custom one. 如果是这样,如果你有一个自定义的,请尝试重新启动芹菜节拍并清除它的数据库后端。

If it does not solve the problem, please post your celery conf, and make sure you have cleaned all the .pyc of your project and restarted everything. 如果它没有解决问题,请发布您的芹菜conf,并确保您已清理项目的所有.pyc并重新启动所有内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM