Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mbourqui/django-celery-growthmonitor
Helper to monitor jobs running Celery tasks in Django
https://github.com/mbourqui/django-celery-growthmonitor
celery celery-tasks django python utility
Last synced: about 1 month ago
JSON representation
Helper to monitor jobs running Celery tasks in Django
- Host: GitHub
- URL: https://github.com/mbourqui/django-celery-growthmonitor
- Owner: mbourqui
- License: gpl-3.0
- Created: 2017-07-04T12:10:19.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-03-08T20:35:45.000Z (almost 3 years ago)
- Last Synced: 2024-08-08T23:44:00.489Z (5 months ago)
- Topics: celery, celery-tasks, django, python, utility
- Language: Python
- Homepage:
- Size: 174 KB
- Stars: 4
- Watchers: 2
- Forks: 5
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[![Python](https://img.shields.io/badge/Python-3.5,3.6,3.7,3.8,3.9-blue.svg?style=flat-square)](/)
[![Django](https://img.shields.io/badge/Django-2.2,3.2-blue.svg?style=flat-square)](/)
[![License](https://img.shields.io/badge/License-GPLv3-blue.svg?style=flat-square)](/LICENSE)
[![PyPI](https://img.shields.io/pypi/v/django_celery_growthmonitor.svg?style=flat-square)](https://pypi.org/project/django-celery-growthmonitor)
[![Build Status](https://travis-ci.org/mbourqui/django-celery-growthmonitor.svg?branch=master)](https://travis-ci.org/mbourqui/django-celery-growthmonitor)
[![Coverage Status](https://coveralls.io/repos/github/mbourqui/django-celery-growthmonitor/badge.svg?branch=master)](https://coveralls.io/github/mbourqui/django-celery-growthmonitor?branch=master)
[![Downloads](https://pepy.tech/badge/django-celery-growthmonitor)](https://pepy.tech/project/django-celery-growthmonitor)# Django-Celery-GrowthMonitor
A Django helper to monitor jobs running Celery tasks
## Features
* Utilities to track progress of Celery tasks via in-database jobs
* Designed for jobs with user-uploaded files## Requirements
* [Python][] >= 3.5
* [Django][] >= 2.2
* [Celery][] >= 4.0.2
* [echoices][] >= 2.6.0
* [autoslug][] >= 1.9.7## Installation
### Using PyPI
1. Run `pip install django-celery-growthmonitor`### Using the source code
1. Make sure [pandoc][] is installed
1. Run `./pypi_packager.sh`
1. Run `pip install dist/django_celery_growthmonitor-x.y.z-[...].wheel`, where `x.y.z` must be replaced by the actual
version number and `[...]` depends on your packaging configuration## Usage
```Django
('state', echoices.fields.make_echoicefield(default=celery_growthmonitor.models.AJob.EState.CREATED, echoices=celery_growthmonitor.models.AJob.EState, editable=False)),
('status', echoices.fields.make_echoicefield(default=celery_growthmonitor.models.AJob.EStatus.ACTIVE, echoices=celery_growthmonitor.models.AJob.EStatus, editable=False)),
``````Django
from .celery import app@app.task
def my_task(holder: JobHolder, *args):
job = holder.get_job()
if job.has_failed():
# Just skip the whole if the previous task failed
return holder.pre_serialization()
# Some processing
...
job.save()
return holder.pre_serialization()
```### Helpers
Automatically set the job failed on task failure using custom base Task class
```Django
from celery_growthmonitor.models.task import JobFailedOnFailureTask@app.task(base=JobFailedOnFailureTask, bind=True)
def my_task(self, holder: JobHolder):
pass
```#### Admin
```Django
from django.contrib import adminfrom celery_growthmonitor.admin import AJobAdmin
@admin.register(MyJob)
class MyJobAdmin(AJobAdmin):
fields = AJobAdmin.fields + ('my_extra_field',)
readonly_fields = AJobAdmin.readonly_fields + ('my_extra_field',)```
[python]: https://www.python.org/ "Python"
[django]: https://www.djangoproject.com/ "Django"
[celery]: http://www.celeryproject.org/ "Celery"
[echoices]: https://github.com/mbourqui/django-echoices "django-echoices"
[autoslug]: https://github.com/justinmayer/django-autoslug "django-autoslug"
[pandoc]: http://pandoc.org/index.html "pandoc"