django celery 终止任务的子进程
这是我之前问题的后续问题: 用 Celery 取消已经执行的任务?
celery.task.control.revoke({task_id}, terminate=True)
确实杀死我运行任务的工人。我现在遇到的问题是,我的任务正在运行子进程,当任务被撤销时,这些子进程不会终止。
这篇文章由 dmarkey 发表 http:// /dmarkey.com/wordpress/2011/09/07/killing-child-processes-of-celery-tasks-on-a-timeout/ 是我见过的最接近我想要做的事情,除了我不想在超时时杀死,而是当我用task_id撤销()时。
似乎我所拥有的只是(字符串)task_id,有没有办法杀死这样的子进程?感谢您的帮助 - 我在这方面没有我想要的那么多经验,浏览文档是一个挑战!
This is a follow-up question to my previous question:
Cancel an already executing task with Celery?
celery.task.control.revoke({task_id}, terminate=True)
does indeed kill my worker running the task. I am now having the issue that my task is running subprocesses that do not die when the task is revoked.
This post by dmarkey
http://dmarkey.com/wordpress/2011/09/07/killing-child-processes-of-celery-tasks-on-a-timeout/
is the closest I've seen to what I want to do, except I don't want to kill on timeout, but rather when I revoke() with the task_id.
Seeming that all I have is the (String) task_id, is there anyway to kill such subprocesses? Thanks for your help - I don't have quite as much experience with this as I'd like, navigating the docs is a challenge!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试为
on_revoked
杀死任务的子进程。Try setting a callback for
on_revoked
that kills the child processes of the task.