New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

django-celery-progressbar

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

django-celery-progressbar

Progress bar for Django Celery application

  • 0.2.3
  • PyPI
  • Socket score

Maintainers
1

==================================== Django Celery Progressbar

.. 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

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:

.. 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.

================= Configuration

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

======= License

  • Free software: MIT license

History

0.2.3 (2020-07-12)

  • added proper documentation

0.2.2 (2020-07-12)

  • added dynamic property to ProgressBar

0.2.1 (2020-07-12)

  • minor cosmetics

0.2.0 (2020-06-28)

  • added possibility for dynamic updates in runtime
  • added update() method to ProgressBar class
  • fixed a bug with finalize() method

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

FAQs


Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc