Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to revoke the task while running

When I send a task and I try to revoke:

app=Celery()
app.control.revoke(task.id)
#or
app.control.revoke(task.id, terminate=True)

I get that error:

[2019-09-05 05:27:50,110: ERROR/MainProcess] pidbox command error: NotImplementedError("<class 'celery.concurrency.gevent.TaskPool'> does not implement kill_job",)

I'm using gevent.

celery -A MyApp worker -l info -P gevent

what's wrong?

like image 555
JuConte Avatar asked Feb 05 '26 10:02

JuConte


1 Answers

gevent concurrency does not allow killing of the jobs. Pre-fork does allow it as it is as simple as killing the worker-process that is running the task that you want to terminate, same goes for threading.

There is an issue about this, with a proposed solution - https://github.com/celery/celery/issues/4019 - but nobody made a PR.

like image 64
DejanLekic Avatar answered Feb 07 '26 22:02

DejanLekic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!