Skip to main content

AMQP based worker/master pattern framework

Project description

AMQP based RPC library for Tornado

Use cases

  • Task queue
  • Load balancing for different CPU-bound HTTP handlers
  • … other systems which involve RPC


pip install crew


See the full example.


For example create your first app, and save as

import tornado.ioloop
import tornado.gen
import tornado.web
import tornado.log
import json
import tornado.options
from crew import TimeoutError, ExpirationError
from crew.master.tornado import Client

class MainHandler(tornado.web.RequestHandler):

    def get(self):
        resp = yield self.settings['crew'].call(None, priority=100)

cl = Client()
application = tornado.web.Application(
        (r"/", MainHandler),

if __name__ == "__main__":

And create your first task, and save as

# encoding: utf-8
from crew.worker import run, context, Task

def long_task(req):
    context.settings.counter += 1
    return {"counter": context.settings.counter}


After that run it:

$ python &
$ python &
$ wait

Try to test it:

$ curl http://localhost:8888/

Project details

Download files

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

Files for crew, version 0.9.0
Filename, size File type Python version Upload date Hashes
Filename, size crew-0.9.0.macosx-10.11-x86_64.tar.gz (29.8 kB) File type Dumb Binary Python version any Upload date Hashes View hashes
Filename, size crew-0.9.0-py2.7.egg (16.1 kB) File type Egg Python version 2.7 Upload date Hashes View hashes
Filename, size crew-0.9.0-py2-none-any.whl (18.3 kB) File type Wheel Python version 2.7 Upload date Hashes View hashes
Filename, size crew-0.9.0.tar.gz (10.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page