django-celery-oncommit-0.0.2
توضیحات
Celery wrapper that delays tasks until the django transaction has committed
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | django-celery-oncommit-0.0.2 |
| نام | django-celery-oncommit |
| نسخه کتابخانه | 0.0.2 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Martin Chase |
| ایمیل نویسنده | outofculture@gmail.com |
| آدرس صفحه اصلی | https://gitlab.com/outofculture/django-celery-oncommit |
| آدرس اینترنتی | https://pypi.org/project/django-celery-oncommit/ |
| مجوز | BSD |
# django-celery-oncommit
Delay all celery tasks until after the current django transaction has committed to prevent race conditions.
See the [django docs](https://docs.djangoproject.com/en/2.1/topics/db/transactions/#performing-actions-after-commit) for more details.
## Usage
`pip install django-celery-oncommit`
In your task file:
```python
from django_celery_oncommit import task
@task
def some_task(with_args):
"""Task that does stuff with objects"""
pass
```
Elsewhere:
```python
from mytasks import some_task
def function_used_in_django_code():
create_some_objects()
some_task.delay(args_referring_to_new_objects)
slow_operation_that_allows_the_race_condition()
```
Ta da!
## TODO
* provide a non-transaction-based option `apply_async` for when the user explicity knows how they want to interact with transactions
نیازمندی
| مقدار | نام |
|---|---|
| >=1.11 | django |
| >=3.0 | celery |
نحوه نصب
نصب پکیج whl django-celery-oncommit-0.0.2:
pip install django-celery-oncommit-0.0.2.whl
نصب پکیج tar.gz django-celery-oncommit-0.0.2:
pip install django-celery-oncommit-0.0.2.tar.gz