skip to navigation
skip to content

Not Logged In

toro 0.8

Synchronization primitives for Tornado coroutines.

Info:Synchronization primitives for Tornado coroutines.
Author:A. Jesse Jiryu Davis

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

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 3.0.

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 test in the root directory.

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

 
File Type Py Version Uploaded on Size
toro-0.8.tar.gz (md5) Source 2015-01-13 54KB
  • Downloads (All Versions):
  • 129 downloads in the last day
  • 1192 downloads in the last week
  • 3389 downloads in the last month