rq


Namerq JSON
Version 2.0.0 PyPI version JSON
download
home_pageNone
SummaryRQ is a simple, lightweight, library for creating background jobs, and processing them.
upload_time2024-10-28 15:04:40
maintainerSelwin Ong
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            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 status](https://github.com/rq/rq/workflows/Test%20rq/badge.svg)](https://github.com/rq/rq/actions?query=workflow%3A%22Test+rq%22)
[![PyPI](https://img.shields.io/pypi/pyversions/rq.svg)](https://pypi.python.org/pypi/rq)
[![Coverage](https://codecov.io/gh/rq/rq/branch/master/graph/badge.svg)](https://codecov.io/gh/rq/rq)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)


Full documentation can be found [here][d].


## Support RQ

If you find RQ useful, please consider supporting this project via [Tidelift](https://tidelift.com/subscription/pkg/pypi-rq?utm_source=pypi-rq&utm_medium=referral&utm_campaign=readme).


## Getting started

First, run a Redis server, of course:

```console
$ redis-server
```

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

```python
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())
```

Then, create an RQ queue:

```python
from redis import Redis
from rq import Queue

queue = Queue(connection=Redis())
```

And enqueue the function call:

```python
from my_module import count_words_at_url
job = queue.enqueue(count_words_at_url, 'http://nvie.com')
```

Scheduling jobs are also similarly easy:

```python
# Schedule job to run at 9:15, October 10th
job = queue.enqueue_at(datetime(2019, 10, 10, 9, 15), say_hello)

# Schedule job to run in 10 seconds
job = queue.enqueue_in(timedelta(seconds=10), say_hello)
```

Retrying failed jobs is also supported:

```python
from rq import Retry

# Retry up to 3 times, failed job will be requeued immediately
queue.enqueue(say_hello, retry=Retry(max=3))

# Retry up to 3 times, with configurable intervals between retries
queue.enqueue(say_hello, retry=Retry(max=3, interval=[10, 30, 60]))
```

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


### The worker

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

```console
$ rq worker --with-scheduler
*** Listening for work on default
Got count_words_at_url('http://nvie.com') from default
Job result = 818
*** Listening for work on default
```

That's about it.


## Installation

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 git+https://github.com/rq/rq.git@master#egg=rq


## Docs

To build and run the docs, install [jekyll](https://jekyllrb.com/docs/) and run:

```shell
cd docs
jekyll serve
```

## Related Projects

If you use RQ, Check out these below repos which might be useful in your rq based project.

- [django-rq](https://github.com/rq/django-rq)
- [rq-dashboard](https://github.com/Parallels/rq-dashboard)
- [rqmonitor](https://github.com/pranavgupta1234/rqmonitor)
- [Flask-RQ2](https://github.com/rq/Flask-RQ2)
- [rq-scheduler](https://github.com/rq/rq-scheduler)
- [rq-dashboard-fastAPI](https://github.com/Hannes221/rq-dashboard-fast)



## Project history

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


[d]: http://python-rq.org/
[m]: http://pypi.python.org/pypi/mailer
[p]: http://docs.python.org/library/pickle.html
[1]: http://docs.celeryq.dev/
[2]: https://github.com/resque/resque
[3]: https://github.com/fengsp/flask-snippets/blob/1f65833a4291c5b833b195a09c365aa815baea4e/utilities/rq.py

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "rq",
    "maintainer": "Selwin Ong",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Selwin Ong <selwin.ong@gmail.com>, Vincent Driessen <vincent@3rdcloud.com>",
    "download_url": "https://files.pythonhosted.org/packages/e3/29/ce60c4571d51d2b5507961646088999dd0fa63f84c020d61fe6472aa480c/rq-2.0.0.tar.gz",
    "platform": null,
    "description": "RQ (_Redis Queue_) is a simple Python library for queueing jobs and processing\nthem in the background with workers.  It is backed by Redis and it is designed\nto have a low barrier to entry.  It should be integrated in your web stack\neasily.\n\nRQ requires Redis >= 3.0.0.\n\n[![Build status](https://github.com/rq/rq/workflows/Test%20rq/badge.svg)](https://github.com/rq/rq/actions?query=workflow%3A%22Test+rq%22)\n[![PyPI](https://img.shields.io/pypi/pyversions/rq.svg)](https://pypi.python.org/pypi/rq)\n[![Coverage](https://codecov.io/gh/rq/rq/branch/master/graph/badge.svg)](https://codecov.io/gh/rq/rq)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n\nFull documentation can be found [here][d].\n\n\n## Support RQ\n\nIf you find RQ useful, please consider supporting this project via [Tidelift](https://tidelift.com/subscription/pkg/pypi-rq?utm_source=pypi-rq&utm_medium=referral&utm_campaign=readme).\n\n\n## Getting started\n\nFirst, run a Redis server, of course:\n\n```console\n$ redis-server\n```\n\nTo put jobs on queues, you don't have to do anything special, just define\nyour typically lengthy or blocking function:\n\n```python\nimport requests\n\ndef count_words_at_url(url):\n    \"\"\"Just an example function that's called async.\"\"\"\n    resp = requests.get(url)\n    return len(resp.text.split())\n```\n\nThen, create an RQ queue:\n\n```python\nfrom redis import Redis\nfrom rq import Queue\n\nqueue = Queue(connection=Redis())\n```\n\nAnd enqueue the function call:\n\n```python\nfrom my_module import count_words_at_url\njob = queue.enqueue(count_words_at_url, 'http://nvie.com')\n```\n\nScheduling jobs are also similarly easy:\n\n```python\n# Schedule job to run at 9:15, October 10th\njob = queue.enqueue_at(datetime(2019, 10, 10, 9, 15), say_hello)\n\n# Schedule job to run in 10 seconds\njob = queue.enqueue_in(timedelta(seconds=10), say_hello)\n```\n\nRetrying failed jobs is also supported:\n\n```python\nfrom rq import Retry\n\n# Retry up to 3 times, failed job will be requeued immediately\nqueue.enqueue(say_hello, retry=Retry(max=3))\n\n# Retry up to 3 times, with configurable intervals between retries\nqueue.enqueue(say_hello, retry=Retry(max=3, interval=[10, 30, 60]))\n```\n\nFor a more complete example, refer to the [docs][d].  But this is the essence.\n\n\n### The worker\n\nTo start executing enqueued function calls in the background, start a worker\nfrom your project's directory:\n\n```console\n$ rq worker --with-scheduler\n*** Listening for work on default\nGot count_words_at_url('http://nvie.com') from default\nJob result = 818\n*** Listening for work on default\n```\n\nThat's about it.\n\n\n## Installation\n\nSimply use the following command to install the latest released version:\n\n    pip install rq\n\nIf you want the cutting edge version (that may well be broken), use this:\n\n    pip install git+https://github.com/rq/rq.git@master#egg=rq\n\n\n## Docs\n\nTo build and run the docs, install [jekyll](https://jekyllrb.com/docs/) and run:\n\n```shell\ncd docs\njekyll serve\n```\n\n## Related Projects\n\nIf you use RQ, Check out these below repos which might be useful in your rq based project.\n\n- [django-rq](https://github.com/rq/django-rq)\n- [rq-dashboard](https://github.com/Parallels/rq-dashboard)\n- [rqmonitor](https://github.com/pranavgupta1234/rqmonitor)\n- [Flask-RQ2](https://github.com/rq/Flask-RQ2)\n- [rq-scheduler](https://github.com/rq/rq-scheduler)\n- [rq-dashboard-fastAPI](https://github.com/Hannes221/rq-dashboard-fast)\n\n\n\n## Project history\n\nThis project has been inspired by the good parts of [Celery][1], [Resque][2]\nand [this snippet][3], and has been created as a lightweight alternative to the\nheaviness of Celery or other AMQP-based queueing implementations.\n\n\n[d]: http://python-rq.org/\n[m]: http://pypi.python.org/pypi/mailer\n[p]: http://docs.python.org/library/pickle.html\n[1]: http://docs.celeryq.dev/\n[2]: https://github.com/resque/resque\n[3]: https://github.com/fengsp/flask-snippets/blob/1f65833a4291c5b833b195a09c365aa815baea4e/utilities/rq.py\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "RQ is a simple, lightweight, library for creating background jobs, and processing them.",
    "version": "2.0.0",
    "project_urls": {
        "changelog": "https://github.com/rq/rq/blob/master/CHANGES.md",
        "documentation": "https://python-rq.org/docs/",
        "homepage": "https://python-rq.org/",
        "repository": "https://github.com/rq/rq/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "770a09ce745d9639e883888ddae0f71b23a20c59d072eb17b80b8ea8638b16ac",
                "md5": "930b1221f82e9debacf598a7a28dbe21",
                "sha256": "a3a767876675dcc42683bac1869494c5020ba7fcf5c026d1f6d36a8ab98573a6"
            },
            "downloads": -1,
            "filename": "rq-2.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "930b1221f82e9debacf598a7a28dbe21",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 95483,
            "upload_time": "2024-10-28T15:04:37",
            "upload_time_iso_8601": "2024-10-28T15:04:37.566794Z",
            "url": "https://files.pythonhosted.org/packages/77/0a/09ce745d9639e883888ddae0f71b23a20c59d072eb17b80b8ea8638b16ac/rq-2.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e329ce60c4571d51d2b5507961646088999dd0fa63f84c020d61fe6472aa480c",
                "md5": "b9e104a495f06bf14fb94f50dde910f2",
                "sha256": "76d2a4a27f8fd5c4cfa200cd442efe3c1fd73525c676af06f07fcc0b81bdb70d"
            },
            "downloads": -1,
            "filename": "rq-2.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "b9e104a495f06bf14fb94f50dde910f2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 639193,
            "upload_time": "2024-10-28T15:04:40",
            "upload_time_iso_8601": "2024-10-28T15:04:40.337756Z",
            "url": "https://files.pythonhosted.org/packages/e3/29/ce60c4571d51d2b5507961646088999dd0fa63f84c020d61fe6472aa480c/rq-2.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-28 15:04:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rq",
    "github_project": "rq",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "rq"
}
        
Elapsed time: 0.35339s