pypi i django_celery_monitor


Celery Monitoring for Django

by jazzband

1.1.2 (see all)License:BSD
pypi i django_celery_monitor


Celery Monitoring for Django

:Version: 1.1.2 :Web: :Download: :Source: :Keywords: django, celery, events, monitoring

|build-status| |coverage| |license| |wheel| |pyversion| |pyimp|


This extension enables you to monitor Celery tasks and workers.

It defines two models (django_celery_monitor.models.WorkerState and django_celery_monitor.models.TaskState) used to store worker and task states and you can query this database table like any other Django model. It provides a Camera class ( to be used with the Celery events command line tool to automatically populate the two models with the current state of the Celery workers and tasks.


This package is a Celery 4 compatible port of the Django admin based monitoring feature that was included in the old django-celery <> package which is only compatible with Celery < 4.0. Other parts of django-celery were released as django-celery-beat <> (Database-backed Periodic Tasks) and django-celery-results <>_ (Celery result backends for Django).


You can install django_celery_monitor either via the Python Package Index (PyPI) or from source.

To install using pip,:

.. code-block:: console

$ pip install -U django_celery_monitor


To use this with your project you need to follow these steps:

#. Install the django_celery_monitor library:

.. code-block:: console

  $ pip install django_celery_monitor

#. Add django_celery_monitor to INSTALLED_APPS in your Django project's


Note that there is no dash in the module name, only underscores.

#. Create the Celery database tables by performing a database migrations:

.. code-block:: console

  $ python migrate django_celery_monitor

#. Go to the Django admin of your site and look for the "Celery Monitor" section.

Starting the monitoring process

To enable taking snapshots of the current state of tasks and workers you'll want to run the Celery events command with the appropriate camera class

.. code-block:: console

$ celery -A proj events -l info --camera --frequency=2.0

For a complete listing of the command-line options available see:

.. code-block:: console

$ celery events --help


There are a few settings that regulate how long the task monitor should keep state entries in the database. Either of the three should be a datetime.timedelta value or None.

  • monitor_task_success_expires -- Defaults to timedelta(days=1) (1 day)

    The period of time to retain monitoring information about tasks with a SUCCESS result.

  • monitor_task_error_expires -- Defaults to timedelta(days=3) (3 days)

    The period of time to retain monitoring information about tasks with an errornous result (one of the following event states: RETRY, FAILURE, REVOKED.

  • monitor_task_pending_expires -- Defaults to timedelta(days=5) (5 days)

    The period of time to retain monitoring information about tasks with a pending result (one of the following event states: PENDING, RECEIVED, STARTED, REJECTED, RETRY.

In your Celery configuration simply set them to override the defaults, e.g.::

from datetime import timedelta

monitor_task_success_expires = timedelta(days=7)

.. |build-status| image:: :alt: Build status :target:

.. |coverage| image:: :target:

.. |license| image:: :alt: BSD License :target:

.. |wheel| image:: :alt: django-celery-monitor can be installed via wheel :target:

.. |pyversion| image:: :alt: Supported Python versions. :target:

.. |pyimp| image:: :alt: Support Python implementations. :target:

6yrs ago
6yrs ago
6yrs ago
6yrs ago
No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

No reviews found
Be the first to rate