django-celery-model is an extension to Celery which adds support for tracking Celery tasks assigned to Django model instances.
Project description
[django-celery-model](https://github.com/mback2k/django-celery-model) is an
extension to [Celery](https://github.com/celery/celery) which adds support
for tracking Celery tasks assigned to Django model instances.
Installation
------------
Install the latest version from pypi.python.org:
pip install django-celery-model
Install the development version by cloning the source from github.com:
pip install git+https://github.com/mback2k/django-celery-model.git
Configuration
-------------
Add the package to your `INSTALLED_APPS`:
INSTALLED_APPS += (
'djcelery_model',
)
Example
-------
Add the TaskMixin to your Django model:
from django.db import models
from django.utils.translation import ugettext_lazy as _
from djcelery_model.models import TaskMixin
class MyModel(TaskMixin, models.Model):
name = models.CharField(_('Name'), max_length=100)
Queue an asynchronous task from your Django model instance:
from .models import MyModel
from .tasks import mytask
mymodel = MyModel.objects.get(name='test instance')
mymodel.apply_async(mytask, ...)
Retrieve list of asynchronous tasks assigned to your Django model instance:
mymodel.tasks.all()
mymodel.tasks.pending()
mymodel.tasks.started()
mymodel.tasks.retrying()
mymodel.tasks.failed()
mymodel.tasks.successful()
mymodel.tasks.running()
mymodel.tasks.ready()
Check for a running or ready asynchronous task for your Django model instance:
mymodel.has_running_task
mymodel.has_ready_task
Handle asynchronous task results for your Django model instance:
mymodel.get_task_results()
mymodel.get_task_result(task_id)
mymodel.clear_task_results()
mymodel.clear_task_result(task_id)
Filter your Django model based upon asynchronous tasks:
MyModel.objects.with_tasks()
MyModel.objects.with_pending_tasks()
MyModel.objects.with_started_tasks()
MyModel.objects.with_retrying_tasks()
MyModel.objects.with_failed_tasks()
MyModel.objects.with_successful_tasks()
MyModel.objects.with_running_tasks()
MyModel.objects.with_ready_tasks()
MyModel.objects.without_tasks()
MyModel.objects.without_pending_tasks()
MyModel.objects.without_started_tasks()
MyModel.objects.without_retrying_tasks()
MyModel.objects.without_failed_tasks()
MyModel.objects.without_successful_tasks()
MyModel.objects.without_running_tasks()
MyModel.objects.without_ready_tasks()
License
-------
* Released under MIT License
* Copyright (c) 2014-2016 Marc Hoersken <info@marc-hoersken.de>
extension to [Celery](https://github.com/celery/celery) which adds support
for tracking Celery tasks assigned to Django model instances.
Installation
------------
Install the latest version from pypi.python.org:
pip install django-celery-model
Install the development version by cloning the source from github.com:
pip install git+https://github.com/mback2k/django-celery-model.git
Configuration
-------------
Add the package to your `INSTALLED_APPS`:
INSTALLED_APPS += (
'djcelery_model',
)
Example
-------
Add the TaskMixin to your Django model:
from django.db import models
from django.utils.translation import ugettext_lazy as _
from djcelery_model.models import TaskMixin
class MyModel(TaskMixin, models.Model):
name = models.CharField(_('Name'), max_length=100)
Queue an asynchronous task from your Django model instance:
from .models import MyModel
from .tasks import mytask
mymodel = MyModel.objects.get(name='test instance')
mymodel.apply_async(mytask, ...)
Retrieve list of asynchronous tasks assigned to your Django model instance:
mymodel.tasks.all()
mymodel.tasks.pending()
mymodel.tasks.started()
mymodel.tasks.retrying()
mymodel.tasks.failed()
mymodel.tasks.successful()
mymodel.tasks.running()
mymodel.tasks.ready()
Check for a running or ready asynchronous task for your Django model instance:
mymodel.has_running_task
mymodel.has_ready_task
Handle asynchronous task results for your Django model instance:
mymodel.get_task_results()
mymodel.get_task_result(task_id)
mymodel.clear_task_results()
mymodel.clear_task_result(task_id)
Filter your Django model based upon asynchronous tasks:
MyModel.objects.with_tasks()
MyModel.objects.with_pending_tasks()
MyModel.objects.with_started_tasks()
MyModel.objects.with_retrying_tasks()
MyModel.objects.with_failed_tasks()
MyModel.objects.with_successful_tasks()
MyModel.objects.with_running_tasks()
MyModel.objects.with_ready_tasks()
MyModel.objects.without_tasks()
MyModel.objects.without_pending_tasks()
MyModel.objects.without_started_tasks()
MyModel.objects.without_retrying_tasks()
MyModel.objects.without_failed_tasks()
MyModel.objects.without_successful_tasks()
MyModel.objects.without_running_tasks()
MyModel.objects.without_ready_tasks()
License
-------
* Released under MIT License
* Copyright (c) 2014-2016 Marc Hoersken <info@marc-hoersken.de>
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-model-0.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8771f348987afe404ff620b818888f8d08a075c8d456011424bc0b211df5b641 |
|
MD5 | e277c56a0f5bb248b8927dcb7df2f90c |
|
BLAKE2b-256 | 14a51f9b7d79a6517ecb8492779ee8c87c847adcfebb07cf52e3576b900415ec |
Close
Hashes for django_celery_model-0.1.3-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e203bb634749bfd17b00d62b8d3dc450192c8d9ac18a8b41dd4bbca3a8491ac |
|
MD5 | f73f6c16a29fc10de80c1d188cca1132 |
|
BLAKE2b-256 | a37e0b97ec128795db10bc0c86ab06e1725564ee98e1794bd56c973357018ad9 |