Metadata-Version: 2.4
Name: django-tasks-rq
Version: 0.12.0
Summary: A Django Tasks backend which uses RQ as its underlying queue
Author: Jake Howard
License-Expression: BSD-3-Clause
Project-URL: Source, https://github.com/RealOrangeOne/django-tasks-rq
Project-URL: Issues, https://github.com/RealOrangeOne/django-tasks-rq/issues
Project-URL: Changelog, https://github.com/RealOrangeOne/django-tasks-rq/releases
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django
Classifier: Framework :: Django :: 4.2
Classifier: Framework :: Django :: 5.0
Classifier: Framework :: Django :: 5.1
Classifier: Framework :: Django :: 5.2
Classifier: Framework :: Django :: 6.0
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Natural Language :: English
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Django>=4.2
Requires-Dist: typing_extensions
Requires-Dist: django-stubs-ext
Requires-Dist: django-rq
Requires-Dist: rq>=2.5
Requires-Dist: rq_scheduler
Requires-Dist: django-tasks>=0.12.0
Dynamic: license-file

# Django Tasks RQ

[![CI](https://github.com/RealOrangeOne/django-tasks-rq/actions/workflows/ci.yml/badge.svg)](https://github.com/RealOrangeOne/django-tasks-rq/actions/workflows/ci.yml)
![PyPI](https://img.shields.io/pypi/v/django-tasks-rq.svg)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-tasks-rq.svg)
![PyPI - Status](https://img.shields.io/pypi/status/django-tasks-rq.svg)
![PyPI - License](https://img.shields.io/pypi/l/django-tasks-rq.svg)


A [Django Tasks](https://docs.djangoproject.com/en/stable/topics/tasks/) backend which uses RQ as its underlying queue.

## Installation

```
python -m pip install django-tasks
```

First, add `django_tasks_rq` to your `INSTALLED_APPS`:

```python
INSTALLED_APPS = [
    # ...
    "django_tasks_rq",
]
```

Finally, add it to your `TASKS` configuration:

```python
TASKS = {
    "default": {
        "BACKEND": "django_tasks_rq.RQBackend",
        "QUEUES": ["default"]
    }
}
```

## Usage

The RQ-based backend acts as an interface between [Django's tasks interface](https://docs.djangoproject.com/en/stable/topics/tasks/) and `RQ`, allowing tasks to be defined and enqueued using `django.tasks`, but stored in Redis and executed using RQ's workers.

Any queues defined in `QUEUES` must also be defined in `django-rq`'s `RQ_QUEUES` setting.

### Job class

To use `rq` with `django-tasks-rq`, a custom `Job` class must be used. This can be passed to the worker using `--job-class`:

```shell
./manage.py rqworker --job-class django_tasks_rq.Job
```

### Priorities

`rq` has no native concept of priorities - instead relying on workers to define which queues they should pop tasks from in order. Therefore, `task.priority` has little effect on execution priority.

If a task has a priority of `100`, it is enqueued at the top of the queue, and will be the next task executed by a worker. All other priorities will enqueue the task to the back of the queue. The queue value is not stored, and will always be `0`.

## Contributing

See [CONTRIBUTING.md](./CONTRIBUTING.md) for information on how to contribute.

Note: Prior to `0.12.0`, this backend was included in [`django-tasks`](https://github.com/RealOrangeOne/django-tasks/). Whilst the commit history was cleaned up, it's still quite messy. Don't look too closely.
