Hello world!
Maybe I am missing something but is there a simple way at some point in the future to revoke all tasks of a chain?
Problem: From a web service I create a chain of possibly long running tasks and at some point in the future a user might want to stop processing of these tasks.
The system is still in development and at the moment I create the chain, collect all the task IDs und store them in a database. Kind of like this:
res = (task.s() | task.s() | task.s() | task.s() | task.s())()
save_them_to_the_db(tasks)
Then, some time in the future, the user might want to stop processing of these tasks, clicks on his Abort-Button and the system would get the task IDs from the DB and I do basically something like this:
celery.control.revoke(t, terminate=True, signal="SIGABRT")
(I send SIGABRT’s because I use a simple signal handler to interrupt the work inside of the task.)
Now, I wonder, is there a simpler way to revoke all the tasks of the chain? Revoking a single task is something simple like this:
res = result.AsyncResult(task_id)
res.revoke()
Or:
celery.control.revoke(task_id)
Would it be possible (maybe in future releases) to simply store the ID of the group in the database and then, when the user wants to stop all the tasks, just do something like:
c = chain.load(id)
c.revoke()
Or something like that. Or am I missing something here?
Oh, and while we are at it, let me say that from what I have seen so far Celery looks fantastic! :-)
Regards,
Tobias.