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:
  1. 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 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.engine
def consumer():
    while True:
        item = yield gen.Task(q.get)
        try:
            print 'Doing work on', item
        finally:
            q.task_done()

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

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

Documentation

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

$ sphinx-build doc build

Testing

pip install nose and run nosetests 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-0.1.1.tar.gz (56.9 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for toro-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0c9400a6308d5a8ee4193798d6d08acc12966c4aaf80eddf531357adec072321
MD5 ceb10c913fce68b8c23c2ee94f3bbe1f
BLAKE2b-256 c501213eb8ff040575f654f5264c835ef836c81375e3d17aacb08f87b6aeefe1

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