tornadio2.gen

tornadio2.gen

Generator-based interface to make it easier to work in an asynchronous environment.

Wrapper

tornadio2.gen.sync_engine(func)[source]

Queued version of the tornado.gen.engine.

Prevents calling of the wrapped function if there is already one instance of the function running asynchronously. Function will be called synchronously without blocking io_loop.

This decorator can only be used on class methods, as it requires self to make sure that calls are scheduled on instance level (connection) instead of class level (method).

Internal API

class tornadio2.gen.SyncRunner(gen, callback)[source]

Customized tornado.gen.Runner, which will notify callback about completion of the generator.

SyncRunner.__init__(gen, callback)[source]

Constructor.

gen
Generator
callback
Function that should be called upon generator completion