Synchronization primitives for Tornado coroutines.
Project description
- 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 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!
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
File details
Details for the file toro-0.5.tar.gz
.
File metadata
- Download URL: toro-0.5.tar.gz
- Upload date:
- Size: 54.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f4677db5d25621df4489ddd3d5608b69e620484abe180db9397eecf7afc358e |
|
MD5 | e0377eea4c69868e1d6367f1aa918558 |
|
BLAKE2b-256 | 9c48abfcd5b55d5fdd9db6460d69893dbe672eff0af193e953fafe17133ccf3a |