Skip to main content

Synchronization primitives for Tornado coroutines.

Project description

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 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!

Project details


Download files

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

Source Distribution

toro-1.0.tar.gz (57.2 kB view details)

Uploaded Source

File details

Details for the file toro-1.0.tar.gz.

File metadata

  • Download URL: toro-1.0.tar.gz
  • Upload date:
  • Size: 57.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for toro-1.0.tar.gz
Algorithm Hash digest
SHA256 5b8808cf99ede4e945a251ad977a727cbbf94d8f6b274b6d5456373d9cb77f1b
MD5 87b69e90ed751424c5e8a4e828960cd8
BLAKE2b-256 8e09ba6fccaa1be27d1ba987582a0a5cca9868ba3b51b1c73126706c5036fd9e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page