Atomic transaction aware Celery tasks for Django 1.6+
Project description
django_atomic_celery provides a Django 1.6-1.7 compatible approach to transactionally aware approach to Celery task scheduling.
Installation
To install django_atomic_celery, do yourself a favor and don’t use anything other than pip:
$ pip install django-atomic-celery
Add django_atomic_celery along with its dependency, django_atomic_signals, to the list of installed apps in your settings file:
INSTALLED_APPS = (
'django_atomic_signals',
'django_atomic_celery',
..
)
Usage
Using django_atomic_celery is exactly like using Celery the way you normally would. However, instead of importing Celery’s variant of the task decorator, import it from django_atomic_celery:
from django_atomic_celery import task
@task
def simple_task():
..
@task(ignore_result=True, max_retries=3, default_retry_delay=10)
def retrying_task(arg):
..
If you use Celery 3.1 and its internal integration of Django, you can choose to instantiate your Celery app providing the atomic task class as the task_cls argument to have all tasks be atomic transaction aware. Based on an example from the Celery documentation this is done as follows:
from celery import Celery
..
app = Celery('proj', task_cls='django_atomic_celery:PostTransactionTask')
..
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for django-atomic-celery-1.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6a5a028162bf8d8a1fbf8d1d63760e5e68882316cb196393c302d6f804a04ba |
|
MD5 | eb2c783ce1c7958ffc13a55d5152d0e3 |
|
BLAKE2b-256 | 2b5ddba691effed8a7961fba4033b9a8715363c5c57ed4ca774eaf7de14a2576 |