Github url


by rq

rq /rq

Simple job queues for Python

7.1K Stars 1.1K Forks Last release: 9 days ago (v1.4.3) Other 1.5K Commits 57 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

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 should be integrated in your web stack easily.

RQ requires Redis >= 3.0.0.

Build statusPyPICoverage

Full documentation can be found here.

Support RQ

If you find RQ useful, please consider supporting this project via Tidelift.

Getting started

First, run a Redis server, of course:

$ redis-server

To put jobs on queues, you don't have to do anything special, just define your typically lengthy or blocking function:

import requests def count\_words\_at\_url(url): """Just an example function that's called async.""" resp = requests.get(url) return len(resp.text.split())

You do use the excellent requests package, don't you?

Then, create an RQ queue:

from redis import Redis from rq import Queue q = Queue(connection=Redis())

And enqueue the function call:

from my\_module import count\_words\_at\_url job = q.enqueue(count\_words\_at\_url, '')

For a more complete example, refer to the docs. But this is the essence.

The worker

To start executing enqueued function calls in the background, start a worker from your project's directory:

$ rq worker \*\*\* Listening for work on default Got count\_words\_at\_url('') from default Job result = 818 \*\*\* Listening for work on default

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 git+[email protected]#egg=rq

Related Projects

Check out these below repos which might be useful in your rq based project.

Project history

This project has been inspired by the good parts of Celery, Resqueand this snippet, and has been created as a lightweight alternative to the heaviness of Celery or other AMQP-based queueing implementations.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.