
Security News
OpenGrep Restores Fingerprinting in JSON and SARIF Outputs
OpenGrep has restored fingerprint and metavariable support in JSON and SARIF outputs, making static analysis more effective for CI/CD security automation.
django-celery-progressbar
Advanced tools
.. image:: https://travis-ci.org/mora9715/django-celery-progressbar.svg?branch=master :target: https://travis-ci.org/mora9715/django-celery-progressbar
.. image:: https://badge.fury.io/py/django-celery-progressbar.svg :target: https://badge.fury.io/py/django-celery-progressbar
Simple progressbar for a Django application with Celery. Uses database as a temporary storage.
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:
.. code-block:: python
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:
.. code-block:: python
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%
Keep in mind: as ProgressBar fetches DB object on creation, it is not updated dynamically.
The following default settings can be overridden in your settings.py:
.. code-block:: python
PROGRESSBAR_DEFAULT_TOTAL = 100
PROGRESSBAR_DESTROY_ON_EXIT = False
PROGRESSBAR_DYNAMIC_UPDATE = False
PROGRESSBAR_DEFAULT_TOTAL - Default value for 'Total' progressbar attribute PROGRESSBAR_DESTROY_ON_EXIT - Destroy model object on task completion PROGRESSBAR_DYNAMIC_UPDATE - Dynamically update progressbar DB object in runtime. You don't need it turned on in stateless apps
FAQs
Progress bar for Django Celery application
We found that django-celery-progressbar demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
OpenGrep has restored fingerprint and metavariable support in JSON and SARIF outputs, making static analysis more effective for CI/CD security automation.
Security News
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.