Skip to main content
# django-celery-inspect

Django reusable-app that uses Celery Inspect command to monitor workers via the [Django REST Framework](https://github.com/tomchristie/django-rest-framework).

The main idea is to be able to monitor celery workers from another external service or server via a REST API and figure out if they are running or not by using celery's own [Inspect API]
(http://docs.celeryproject.org/en/latest/userguide/workers.html#inspecting-workers).

## Quick start

1. Install:

pip install django-celery-inspect

2. Add "celery_inspect" to your INSTALLED_APPS setting like this:

INSTALLED_APPS = [

...
'celery_inspect',
]

3. Add the following to your urls.py:

url(r'^api/v1/celery-inspect/', include('celery_inspect.urls', namespace='celery_inspect')),

4. If you Desire to use DRF's Authentication to protect these endpoints (Optional).

REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.TokenAuthentication',
),
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated',
),
}

## Usage:

1. http://localhost:8000/api/v1/celery-inspect/ping/

{
"worker2@localhost:8000": {
"ok": "pong"
},
"worker1@localhost:8000": {
"ok": "pong"
}
}

2. http://localhost:8000/api/v1/celery-inspect/active/

{
"worker2@localhost:8000": [],
"worker1@localhost:8000": []
}

3. http://localhost:8000/api/v1/celery-inspect/registered/

{
"worker2@localhost:8000": [
"core.tasks.db_backup",
"core.tasks.send_queued_emails",
"yy.tasks.assign_to_mongo",
"xx.tasks.check_for_new_registered",
"xx.tasks.create_and_associate_manager",
"qq.celery.debug_task"
],
"worker1@localhost:8000": [
"core.tasks.db_backup",
"core.tasks.send_queued_emails",
"yy.tasks.assign_to_mongo",
"xx.tasks.check_for_new_registered",
"xx.tasks.create_and_associate_manager",
"qq.celery.debug_task"
]
}

4. http://localhost:8000/api/v1/celery-inspect/scheduled/

{
"worker2@localhost:8000": [],
"worker1@localhost:8000": []
}



### If for some reason you can only deal with status codes (This feature will only work if you have django-celery installed)

1. http://localhost:8000/api/v1/celery-inspect/active-status/

- Returns 200 if all workers in WorkerState are up.
- Returns 404 if workers are down (WorkerState != then inspect()).
- Returns 501 if djcelery a.k.a django-celery is not installed.

Release files for django-celery-inspect 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-celery-inspect 0.2.1
File Size Uploaded
django-celery-inspect-0.2.1.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-celery-inspect 0.2.1
File Interpreter ABI Platform
django_celery_inspect-0.2.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 14.5 kB

Release files / django-celery-inspect-0.2.1.tar.gz

Download URL django-celery-inspect-0.2.1.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5b824bae357ef86696b09a0e654c5a5769e66ebee7546e0c61d17136476c7f42
BLAKE2b-256 checksum
How to use checksums
7fa06f669b367d58e41e0c37e2e4f74445cfb8d6c5d0fc692cb0cd0c7edbc798
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_celery_inspect-0.2.1-py2.py3-none-any.whl

Download URL django_celery_inspect-0.2.1-py2.py3-none-any.whl
Size 9.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
31da8603dd2ef9214e01bf0501429fbcd326346de2023d2104068d248fbb99f4
BLAKE2b-256 checksum
How to use checksums
1c1a5065c1da51098404ba3bbd7dbf29d8137c94f9cb397caaed4be3914a286f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2

2 release files

0.1

2 release files

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