Just get the id list of all instances Aand stop them.
Consider this simple chord
from celery import chord
my_chord = chord(a.si() for i in range(300))(b.si())
Now you can get the list of subtasks (all lines of the task A) from the instance my_chordusing
for taks in my_chord.parent.subtasks:
print(task.id)
Now you can do whatever you want with these tasks. For example, you can undo everything regardless of their current state.
from celery.task.control import revoke
for task in my_chord.parent.subtasks:
revoke(task.id, terminate=True)
revokeby default, kills only unfinished tasks. But if you give it to him terminate=True, he will also destroy the tasks that are performed.
, . , , . , .