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

circus_tornado

A tornado application implementation compatible with circus sockets.

As tornado is not WSGI complient, we cannot use chaussette to run tornado applications with circus sockets.

This project package a compatible version of tornado Application so you can easily run tornado with all circus awesomeness.

Use circus_tornado

Let’s take a simple example, the hello world:

import tornado.ioloop
import tornado.web

from tornado.web import Application

class MainHandler(tornado.web.RequestHandler):
    def get(self):
        self.write("Hello, world")

application = Application([
    (r"/", MainHandler),
])

if __name__ == "__main__":
    application.listen(8888)
    tornado.ioloop.IOLoop.instance().start()

If you want to run it with circus, you can’t use socket web and fallback to launch them and let it bind its socket:

[watcher:hello]
cmd = python hello_world.py

But good news, with circus_tornado, it’s no longer true. Just import Application from circus_tornado package:

import tornado.ioloop
import tornado.web

from tornado_circus import Application

class MainHandler(tornado.web.RequestHandler):
    def get(self):
        self.write("Hello, world")

application = Application([
    (r"/", MainHandler),
])

if __name__ == "__main__":
    parse_command_line()
    application.listen(8888)
    tornado.ioloop.IOLoop.instance().start()

One last requirement, you must call tornado.options.parse_command_line before calling application.listen or it will doesn’t works.

And finally the circus configuration:

[watcher:hello]
cmd = python hello_world.py --fd=$(circus.sockets.hello)
use_sockets = True

[socket:hello]
host = 127.0.0.1
port = 9000

And you’re done. You can go to http://localhost:9000 to check if it works.

You can even launch a quick benchmark and check that it holds the load:

$> boom -n 10000 -c 100 http://localhost:9000                       10:38:48
Server Software: TornadoServer/2.4.1
Running GET http://127.0.0.1:9000
    Host: localhost
Running 10000 times per 100 workers.
Starting the load [===...===] Done

-------- Errors --------

-------- Results --------
Successful calls        10000
Total time              9.3364 s
Average                 0.0656 s
Fastest                 0.0228 s
Slowest                 0.1009 s
Amplitude               0.0781 s
RPS                     1071
BSI                     Woooooo Fast

-------- Status codes --------
Code 200                10000 times.

-------- Legend --------
RPS: Request Per Second
BSI: Boom Speed Index
Release History

Release History

0.0.1

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
tornado_circus-0.0.1.tar.gz (1.1 kB) Copy SHA256 Checksum SHA256 Source Jul 22, 2013

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