I'm unable to get the list of the tasks (actives, scheduled ..) in Celery.
With django, my web application send a task with celery each time the url is asked with :
tasksend = calcul.delay()
I don't want to launch this calcul if it is already in progress in celery.
So, I want to list the tasks Received by Celery and not yet finished : if my 'calcul' task is already in progress, i will then be able not to ask again for calcul.delay()
I already search a lot and the responses in Retrieve list of tasks in a queue in Celery are not good for my celery version.
I use : - django 2.0.13 - python 3.4.2 - celery v4.3.0 with redis
I already tried :
def inspect(method):
app = Celery('app', broker='redis://localhost:6379')
inspect_result = getattr(app.control.inspect(), method)()
app.close()
return inspect_result
and print( inspect('active') ) always return None (the same result is achieved with 'registered')
I would like to be able to get the name of the task in progress and scheduled in celery, any idea?