Skip to main content

Celery monitor for Django.

Project description

Version:
1.1.1
Web:

https://django-celery-monitor.readthedocs.io/

Download:

https://pypi-hypernode.com/pypi/django_celery_monitor

Source:

https://github.com/jezdez/django-celery-monitor

Keywords:

django, celery, events, monitoring

Build status coverage BSD License django-celery-monitor can be installed via wheel Supported Python versions. Support Python implementations.

About

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 (django_celery_monitor.camera.Camera) 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.

History

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

Installation

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

To install using pip,:

$ pip install -U django_celery_monitor

Usage

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

  1. Install the django_celery_monitor library:

    $ pip install django_celery_monitor
  2. Add django_celery_monitor to INSTALLED_APPS in your Django project’s settings.py:

    INSTALLED_APPS = (
        ...,
        'django_celery_monitor',
    )

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

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

    $ python manage.py migrate django_celery_monitor
  4. 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 django_celery_monitor.camera.Camera:

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

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

$ celery events --help

Configuration

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)

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_monitor-1.1.1.tar.gz (62.5 kB view details)

Uploaded Source

Built Distribution

django_celery_monitor-1.1.1-py2.py3-none-any.whl (19.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django_celery_monitor-1.1.1.tar.gz.

File metadata

File hashes

Hashes for django_celery_monitor-1.1.1.tar.gz
Algorithm Hash digest
SHA256 8e3441b80ce530349b41f632ce5a9aac12217eca12681c89fd2ed04ed57fe80a
MD5 cd1cd216a9f3ec457d990a97fa32c580
BLAKE2b-256 0a14053f846eb107a94b2ec810af78da3cfd1a92bfb2356003f25e1750f08176

See more details on using hashes here.

Provenance

File details

Details for the file django_celery_monitor-1.1.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_celery_monitor-1.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 fb7c97737fbfd91f0519c27c4b889bc738e2fd655315a63646df5386d4d53ad4
MD5 ef95de2a48494b0b0a34aa2b5f34b3e7
BLAKE2b-256 0f2e8c8bd9ef7dd8fa939d30fba4903748fc6954fa5f6bff18cbca224e7c0569

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page