I have a Django application and React as my frontend framework and I am using celery for running lengthy tasks which do take a lot of time and everything is working fine.
Also I am providing real time status of the each task running on the celery via celery signals and all . Also I have created a database table which stores the status of all the tasks that are running , like when the task is created , i create a row with the parameters and they are unique so that task with same parameters won't run if its already running or is in the queue , so the user interface is good . But there are few tasks which need to stop and also the user have the authority and permission to stop the tasks that are running as i am updating every user for the tasks. Now if the task is in the queue i can use revoke to stop the from being executed .
from celery.task.control import revoke
revoke(task_id, terminate=True)
But the thing is that , i have tasks which are very lengthy , so the user may want to stop the task and focus on other tasks .
I want to stop the current task which is currently being run by the worker . Suppose a task T1 is being executed by the worker , i want to stop that , I have seen every part of internet but could not find a way to do so .
User may want to stop the task and I want to provide that functionality to user for stopping the current running task.
I have also viewed different task management modules like Dramatiq but still you cannot stop the current working task . I have all the data to stop the task like task id and all , but could not find a way to do so .
Any help would be great . Thanks .