Is it possible to show progress bar of django celery task?

pynovice picture pynovice · Feb 27, 2013 · Viewed 11.4k times · Source

I am using database backend in django celery. The task information is stored in a table called: celery_taskmeta in database. This is my task:

@celery.task
def file_transfer(password, source12, destination):
    result = subprocess.Popen(['sshpass', '-p', password, 'rsync', '-az', source12, destination], 
                                    stderr=subprocess.PIPE, stdout=subprocess.PIPE).communicate()[0]
    return result     

I am calling the task like this:

file_transfer.s(password, source12, destination)

Now I want to show the user the progress of their task and time remaining in the Django template. How can I do that?

Answer

Florian Sesser picture Florian Sesser · Feb 28, 2013

Maybe my answer to Django-Celery progress bar is of help (also posted the code to DjangoSnippets, that's how proud I am of that few lines http://djangosnippets.org/snippets/2898/ )