skip to navigation
skip to content

Not Logged In

toro 0.5

Synchronization primitives for Tornado coroutines.

https://raw.github.com/ajdavis/toro/master/doc/_static/toro.png
Info:Synchronization primitives for Tornado coroutines.
Author:A. Jesse Jiryu Davis

Documentation: http://toro.readthedocs.org/

https://travis-ci.org/ajdavis/toro.png

About

A set of locking and synchronizing primitives analogous to those in Python's threading module or Gevent's coros, for use with Tornado's gen.engine.

Dependencies

Tornado >= version 2.3.

Examples

Here's a basic example (for more see the examples section of the docs):

from tornado import ioloop, gen
import toro

q = toro.JoinableQueue(maxsize=3)

@gen.coroutine
def consumer():
    while True:
        item = yield q.get()
        try:
            print 'Doing work on', item
        finally:
            q.task_done()

@gen.coroutine
def producer():
    for item in range(10):
        yield q.put(item)

producer()
consumer()
loop = ioloop.IOLoop.instance()
# block until all tasks are done
q.join().add_done_callback(loop.stop)
loop.start()

Documentation

You will need Sphinx and GraphViz installed to generate the documentation. Documentation can be generated like:

$ sphinx-build doc build

Testing

Run python setup.py nosetests in the root directory.

Toro boasts 100% code coverage, including branch-coverage!

 
File Type Py Version Uploaded on Size
toro-0.5.tar.gz (md5) Source 2013-04-12 53KB
  • Downloads (All Versions):
  • 27 downloads in the last day
  • 221 downloads in the last week
  • 1106 downloads in the last month