This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!
Project Description


Torrelque is a Python 3 package that provides a reliable Redis-backed queues and runs on Tornado IO-loop.

Without further ado it’s easy to say the package is an implementation of the queue described in this blog post with some required changes and improvements.

There’s also a related, synchronous queue package called saferedisqueue.


pip install Torrelque


#!/usr/bin/env python3

import random
import logging

import tornadoredis
from tornado import gen, ioloop
from torrelque import Torrelque

logger = logging.getLogger(__name__)

def produce():
    redis = tornadoredis.Client()
    queue = Torrelque(redis, ioloop.IOLoop.current())
    while True:
        for _ in range(5):
            task = {'value': random.randint(0, 99)}
            logger.debug('Produced task %s', task)
            yield queue.enqueue(task)
        yield gen.sleep(10)

def process(task_data):
    logger.debug('Consmed task %s', task_data)
    yield gen.sleep(1)

def consume():
    redis = tornadoredis.Client()
    queue = Torrelque(redis, ioloop.IOLoop.current())
    while True:
        task_id, task_data = yield queue.dequeue()
        if not task_id:
            yield process(task_data)
            yield queue.release(task_id)
        except Exception:
            logger.exception('Job processing has failed')
            yield queue.requeue(task_id, delay = 30)

def main():
    for _ in range(4):

    yield produce()

if __name__ == '__main__':
    logging.basicConfig(level = logging.DEBUG, format = '%(asctime)s %(message)s')
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
Torrelque-0.1.2.tar.gz (6.0 kB) Copy SHA256 Checksum SHA256 Source Jan 18, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting