I am currently using django with celery and everything works fine.

However I want to be able to give the users an opportunity to cancel a task if the server is overloaded by checking how many tasks are currently scheduled.

How can I achieve this ?

I am using redis as broker. 

I just found this :
[Retrieve list of tasks in a queue in Celery](https://stackoverflow.com/questions/5544629/retrieve-list-of-tasks-in-a-queue-in-celery)

It is somehow relate to my issue but I don't need to list the tasks , just count them :)