def cleartask(self, request): # Given a single task ID, clear it from the queue task_id = request.data.get("task_id") if task_id: queue.clear_job(task_id) return Response({"task_id": task_id}) else: return Response({})
def deletefinishedtasks(self, request): """ Delete all tasks that have succeeded, failed, or been cancelled. """ task_id = request.data.get("task_id") if task_id: queue.clear_job(task_id) else: queue.clear() return Response({})