Reputation: 6753
I want to retry a previously revoked task using a AsyncResult object but I get an error saying that the task will be discarded as soon as I run the task
worker_1 | [2019-06-27 16:04:23,094: INFO/MainProcess] Discarding revoked task: ...
According to the docs a list of revoked tasks is stored in memory by the worker and isn't cleared until the worker is restarted.
Is there another way I can cancel a running task instead of revoking it or can I somehow remove the task from the list of revoked task?
Upvotes: 2
Views: 986
Reputation: 19787
It does not make sense to bring back the revoked task from "the dead".
What I recommend you do is:
Create a new task with the same args as the revoked one.
Use the update_state()
on the task, and specify the metadata that you can use to relate two different tasks (the revoked one, and the new one). Something like tsk.update_state(meta={"job-id": "babadeda123", "client-id": "skynet", "previous-task-id": "64fb925e-86cb-4d29-b4e5-33f41f8416cc"})
where the 64fb925e-86cb-4d29-b4e5-33f41f8416cc is the ID of the revoked task.
Upvotes: 1