Skip to main content

Django Celery Progressbar

https://travis-ci.org/mora9715/django-celery-progressbar.svg?branch=master https://badge.fury.io/py/django-celery-progressbar.svg

Simple progressbar for a Django application with Celery. Uses database as a temporary storage.

Installation

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

Usage

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.progress += 5
    bar.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%

Configuration

The following default settings can be overridden in your settings.py:

PROGRESSBAR_DEFAULT_TOTAL = 100
PROGRESSBAR_DESTROY_ON_EXIT = False

PROGRESSBAR_DEFAULT_TOTAL - Default value for ‘Total’ progressbar attribute PROGRESSBAR_DESTROY_ON_EXIT - Destroy model object on task completion

License

  • Free software: MIT license

History

0.1.1 (2020-06-28)

  • added as_percent attribute to ProgressBar class

  • added finalize() method to ProgressBar class

0.1.0 (2020-06-28)

  • First release on PyPi

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_celery_progressbar-0.1.1.tar.gz (3.8 kB view details)

Uploaded Source

File details

Details for the file django_celery_progressbar-0.1.1.tar.gz.

File metadata

  • Download URL: django_celery_progressbar-0.1.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.7

File hashes

Hashes for django_celery_progressbar-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a3c5248b97db4800f8c86c755fd6d31b82bc14ce075687ea9c6bcdffd2e4f6b5
MD5 ff49ec77e0543d00ad90f87aabc907a3
BLAKE2b-256 64eff60dcc967601b06fa1be61a08de452995b03e4ce6ee8b3ffa7ffd1ef0491

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.3

1 file

0.2.2

1 file

0.2.1

1 file

0.2.0

1 file

This release

0.1.1 This release

1 file

0.1.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page