Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ajdavis/toro
Synchronization primitives for Tornado coroutines
https://github.com/ajdavis/toro
Last synced: 4 days ago
JSON representation
Synchronization primitives for Tornado coroutines
- Host: GitHub
- URL: https://github.com/ajdavis/toro
- Owner: ajdavis
- License: other
- Created: 2012-08-06T20:13:26.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2023-06-14T12:23:44.000Z (over 1 year ago)
- Last Synced: 2024-10-27T03:46:09.734Z (8 days ago)
- Language: Python
- Size: 328 KB
- Stars: 193
- Watchers: 14
- Forks: 12
- Open Issues: 2
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
- starred-awesome - toro - Synchronization primitives for Tornado coroutines (Python)
README
====
toro
====.. image:: https://raw.github.com/ajdavis/toro/master/doc/_static/toro.png
:Info: Synchronization primitives for Tornado coroutines.
:Author: A\. Jesse Jiryu DavisDocumentation: https://toro.readthedocs.io/
.. important:: Toro is completed and deprecated; its features have been merged
into Tornado. Development of locks and queues for Tornado coroutines continues
in Tornado itself... image:: https://travis-ci.org/ajdavis/toro.png
:target: https://travis-ci.org/ajdavis/toroAbout
=====
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`_... _threading module: http://docs.python.org/library/threading.html
.. _coros: http://www.gevent.org/gevent.coros.html
.. _gen.engine: http://www.tornadoweb.org/documentation/gen.html
Dependencies
============
Tornado_ >= version 3.0... _Tornado: http://www.tornadoweb.org/
Examples
========
Here's a basic example (for more see the *examples* section of the docs):.. code-block:: python
from tornado import ioloop, gen
import toroq = 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:.. code-block:: console
$ sphinx-build doc build
.. _Sphinx: http://sphinx.pocoo.org/
.. _GraphViz: http://www.graphviz.org/
Testing
=======Run ``python setup.py test`` in the root directory.
Toro boasts 100% code coverage, including branch-coverage!