停止 celeryd 时出现问题

发布于 2024-10-18 06:02:25 字数 484 浏览 0 评论 0原文

我将 celeryd 作为守护进程运行,但有时我无法优雅地停止它。当我发送 TERM 信号并且队列中有项目时(在本例中为 service celeryd stop),celeryd 将停止接受新作业,并关闭所有工作进程。但是,父进程不会关闭。

我刚刚遇到一个场景,我让 celeryd 在两台独立的工作机器上运行:A 和 B。RabbitMQ 服务器上有大约 1000 条消息,我关闭了 A,并经历了上面解释的情况。 B 继续工作,但随后停止运行,服务器上留下了大约 40 条消息。然而,我能够正确地阻止B。

我重新启动 B,看看它是否会将 40 个项目从队列中删除,但它不会。接下来,我硬杀了A,之后B抢到了,完成了任务。

我的结论是,父进程已为其子进程保留了 RabbitMQ 服务器中的 40 个项目。它会正确地收割子项,但不会将项目释放回 RabbitMQ,除非我手动杀死它。

有人经历过类似的事情吗?

我正在运行 Celery 2.2.2

I'm running celeryd as a daemon, but I sometimes have trouble stopping it gracefully. When I send the TERM signal and there are items in the queue (in this case service celeryd stop) celeryd will stop taking new jobs, and shut down all the worker processes. The parent process, however, won't shut down.

I've just ran into a scenario where I had celeryd running on two separate worker machines: A and B. With about 1000 messages on the RabbitMQ server, I shut down A, and experienced the situation I've explained above. B continued to work, but then stalled with about 40 messages left on the server. I was however, able to stop B correctly.

I restarted B, to see if it would take the 40 items off the queue, but it would not. Next, I hard killed A, after which B grabbed and completed the tasks.

My conclusions is that the parent process has reserved the 40 items from our RabbitMQ server for its children. It will reap the children correctly, but will not release the items back to RabbitMQ unless I manually kill it.

Has anyone experienced something similar?

I'm running Celery 2.2.2

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我恋#小黄人 2024-10-25 06:02:25

我相信这与:

https://github.com/celery/celery/issues/264< /a>

设置应该有效。

CELERY_DISABLE_RATE_LIMITS = False

settings.py 文件中的

I believe this is related to:

https://github.com/celery/celery/issues/264

Setting

CELERY_DISABLE_RATE_LIMITS = False

in your settings.py file should work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文