Deprecated 0.2 API

Flask-RQ 0.2, released in 2012, provided a much lighter API, only the barest wrapper around RQ to use Flask’s config. In 2024, Flask-RQ was adopted by the Pallets-Eco organization, and was entirely rewritten. Flask-RQ 0.3 retains compatibility as best it can with the old API, as an intermediate step for upgrading to 1.0.

Deprecated since version 0.3: The old API is deprecated and will be removed in Flask-RQ 1.0.

API

flask_rq.job(func_or_queue: Callable[[P], R]) JobWrapper[P, R]
flask_rq.job(func_or_queue: str | None = None) Callable[[Callable[[P], R]], JobWrapper[P, R]]

Wrap the decorated function to add an enqueue method to it. job.enqueue() is a shortcut for rq.queue.enqueue(job).

Parameters:

func_or_queue – A job function to wrap. Or a queue name, returning a new decorator.

Deprecated since version 0.3: Will be removed in Flask-RQ 1.0. Use rq.job() instead. The added delay method is renamed to enqueue.

flask_rq.get_queue(name='default', **kwargs)

Get the RQ queue with the given name.

If other arguments are given, create a new queue instance instead of using an existing queue. If the named queue exists, use its connection.

Parameters:
  • name (str) – The name of the queue to get.

  • kwargs (Any) – Create a new queue instance with these arguments.

Return type:

Queue

Deprecated since version 0.3: Will be removed in Flask-RQ 1.0. Use rq.get_queue() instead.

flask_rq.get_worker(*queues)

Get a RQ worker that watches the given queue names.

Parameters:

queues (str) – Names of queues for the worker to watch.

Return type:

Worker

Deprecated since version 0.3: Will be removed in Flask-RQ 1.0. Use rq.make_worker() instead.

Configuration

Configuration keys use the form RQ_{queue}_{arg}. For example, RQ_LOW_DB will configure the db connection argument for the queue named "low". RQ_{queue}_URL can be used to configure a connection by URL rather than args, like redis://localhost:6379/2. The "default" queue always exists, and connects to a local Redis server with its default port if not otherwise configured. If a queue is not otherwise configured, it uses the default’s connection.

app.config |= {
    "RQ_DEFAULT_HOST": "dev.example",
    "RQ_LOW_HOST": "dev.example",
    "RQ_LOW_DB": "1",
    "RQ_HIGH_URL": "redis://dev.example:6379/2",
}