Django Reusable app that uses Celery Inspect command to monitor workers/tasks via the Django REST Framework
Project description
# 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_rnal_",
"xx.tasks.create_and_associate_manager_with_entity",
"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_rnal_",
"xx.tasks.create_and_associate_manager_with_entity",
"qq.celery.debug_task"
]
}
4. http://localhost:8000/api/v1/celery-inspect/scheduled/
{
"worker2@localhost:8000": [],
"worker1@localhost:8000": []
}
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_rnal_",
"xx.tasks.create_and_associate_manager_with_entity",
"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_rnal_",
"xx.tasks.create_and_associate_manager_with_entity",
"qq.celery.debug_task"
]
}
4. http://localhost:8000/api/v1/celery-inspect/scheduled/
{
"worker2@localhost:8000": [],
"worker1@localhost:8000": []
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for django-celery-inspect-0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d96fa81edce4b2d67299e8cb9e34b04343d15a2a9a9be4695bfc14644c45035 |
|
MD5 | 41baf22c4f729dd3b4374380eaf8fab0 |
|
BLAKE2b-256 | e1f259a69aa42a408ddee2223d81e34aac19b7bf5220ff6693bf8ddd1cad2222 |
Close
Hashes for django_celery_inspect-0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 947dbeeef3cadcd0a3391c6cdac4ceb2f65378459082c6db01898824ed9a706e |
|
MD5 | 5bcef55d0f472f2e88fb45defd6c79b4 |
|
BLAKE2b-256 | 5dcceeac548e3871c7fc800c36683c3c55cfe41750780557765bbc8b581ad261 |