Simple progressbar for a Django application with Celery. Uses database as a temporary storage. See full documentation here.
Installation is as simple as installing a package from PyPi and applying migrations:
$ pip install django-celery-progresbar $ python manage.py migrate django_celery_progressbar
Typical usage on the side of Celery task would look like:
from django_celery_progressbar.bars import ProgressBar
from celery import shared_task
@shared_task
def do_something():
bar = ProgressBar(
task_id=do_something.request.id,
total=10,
step='Drying kelp...'
)
some_work()
bar.update(
progress='5',
step='Making sushi...'
)
some_more_work()
bar.progress.finalize()
To retireve current progressbar state, you can use built-in getter:
from django_celery_progressbar.bars import ProgressBar
bar = ProgressBar.get(task_id)
print(bar)
>>> 5 / 10 | Drying kelp...
# or as percent:
print(bar.as_percent)
>>> 50.0%
- Free software: MIT license