芹菜未注册的任务KeyError [英] Celery unregistered task KeyError

查看:76
本文介绍了芹菜未注册的任务KeyError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过在终端中执行以下命令来启动工作程序:

I start the worker by executing the following in the terminal:

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

此问题是 cel_test.grp_all_w_codes.mk_dct 不存在.实际上,甚至没有模块 cel_test.grp_all_w_codes ,更不用说任务 mk_dct 了.几天前只有一次,但此后我将其删除.我以为可能有一个 .pyc 文件在浮动,但是没有.我也无法在代码中找到引发错误的任务的单个引用.我关闭计算机,然后重新启动rabbitmq服务器,以为可能是对某些内容的引用只是停留在内存中,但无济于事.

The problem with this is that cel_test.grp_all_w_codes.mk_dct doesn't exist. In fact there isn't even a module cel_test.grp_all_w_codes let alone the task 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. 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.

有人知道这可能是问题还是我想念的东西?

Does anyone have any idea what could be the problem here or what I'm missing?

推荐答案

好吧,在不知道您的conf文件的情况下,我看到有两个原因会引起这种情况:

Well, without knowing your conf files, I can see two reasons that would provoke this:

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

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

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

如果仍然不能解决问题,请张贴您的celery conf,并确保已清除项目的所有 .pyc 并重新启动所有内容.

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.

这篇关于芹菜未注册的任务KeyError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆