停止 celeryd 时出现问题
我将 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信这与:
https://github.com/celery/celery/issues/264< /a>
设置应该有效。
settings.py 文件中的
I believe this is related to:
https://github.com/celery/celery/issues/264
Setting
in your settings.py file should work.