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!
Try setting a callback for
on_revokedthat kills the child processes of the task.