This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Batch operations for RQ.

WARNING: This package is in the state of proposal. Since I’m trying README Driven Development approach. Expect no patches will be accepted until I make first public release.

Sequential tasks

Execute jobs sequentially on different workers. This primitive is very similar to dependent jobs. The main difference is result of previous job will be passed as an argument to the next job.

from rqbatch import Chain

with Sequential() as s:
    s(add, 1, 2)
    s(add, 3)
    s(add, 4)

# 10

Code above is equivalent for this (except each function application will be performed on different machine).

add(add(add(1, 2), 3), 4)

You can pass default queue settings into sequence constructor.

with Sequential(name='foo', default_timeout=512, connection=redis,
                job_class=CustomJob) as s:

You can pass all parameters available in the enqueue call to the sequence.

with Sequential() as s:, args=(1, 2), ttl=128, timeout=360), args=(3,), queue='foo')
    s(add, 4)


Parallel tasks

Send tasks to execute in parallel. You can pass default settings to the class constructor and override this in the call method arguments.

from rqbatch import Parallel

with Parallel() as p:
    p(add, 1, 2)
    p(add, 3, 4)

# [3, 7]

Combining techniques

It is possible to submit tasks in parallel as part of sequential task plan. In converse you can use sequential tasks as part of parallel task plan. This combinations ban be any level of nesting.

from rqbatch import Sequential, Parallel

def task1(): ...
def task2(r1): ...
def task3(r1): ...
def task4(r1): ...
def task5(r2, r3, r4): ...
def task6(r2, r3, r4): ...
def task7(r2, r3, r4): ...
def task8(r5, r6, r7): ...

with Sequential() as s:
    with s.parallel() as p:
    with s.parallel() as p:

# ?


Batch is a task which runs ones on bulk of data.

from rqbatch import Batch

b = Batch(sum, name='foo', every=100, interval=10)

b.extend(2, 3)

for res in b.results:
# 10

To start processing batches start special worker. This worker will check if foo is a butch or a regular queue and adapt it behavior accordingly.

$ rqbatch worker foo

It also possible to use this from python

from rq import Worker
from rqbatch import BatchMixin

class CustomWorker(BatchMixin, Worker):

worker = CustomWorker('foo')

Worker rate limit

Limit how much task worker can dequeue from queues.

$ rqbatch worker --rate-limit foo 1/s bar 5/m baz 100/h

It also possible to use this from python

from rq import Worker
from rqbatch import RateMixin

class CustomWorker(RateMixin, Worker):

worker = CustomWorker(foo='1/s', bar='5/m', baz='100/h')
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

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
rqbatch-0.1.dev1.tar.gz (2.7 kB) Copy SHA256 Checksum SHA256 Source Jul 24, 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