RQ (Redis Queue) is a simple Python library for queueing jobs and processing them in the background with workers. It is backed by Redis and it is designed to have a low barrier to entry. It can be integrated in your web stack easily.
RQ requires Redis >= 3.0.0.
First, run a Redis server. You can use an existing one. To put jobs on queues, you don’t have to do anything special, just define your typically lengthy or blocking function:
Then, create a RQ queue:
And enqueue the function call:
For a more complete example, refer to the docs. But this is the essence.
To start executing enqueued function calls in the background, start a worker from your project’s directory:
That’s about it.
Simply use the following command to install the latest released version:
pip install rq
If you want the cutting edge version (that may well be broken), use this:
pip install -e firstname.lastname@example.org:nvie/rq.git@master#egg=rq
This project has been inspired by the good parts of Celery, Resque and this snippet, and has been created as a lightweight alternative to existing queueing frameworks, with a low barrier to entry.