is it possible to list all blocked tornado coroutines
<p>I have a "gateway" app written in <code>tornado</code> using <code>@tornado.gen.coroutine</code> to transfer information from one handler to another. I'm trying to do some debugging/status testing. What I'd like to be able to do is enumerate all of the currently blocked/waiting coroutines that are live at a given moment. Is this information accessible somewhere in tornado?</p>

<p>You talk about ioloop <code>_handlers</code> dict maybe. Try to add this in periodic callback:</p>

<pre><code>def print_current_handlers():
    io_loop = ioloop.IOLoop.current()
    print io_loop._handlers
</code></pre>

<p><strong>update</strong>: I've checked source code and now think that there is no simple way to trace current running gen.corouitines, A. Jesse Jiryu Davis is right!</p>

<p>But you can trace all "async" calls (yields) from coroutines - each yield from generator go into <code>IOLoop.add_callback</code> (<a href="http://www.tornadoweb.org/en/stable/ioloop.html#callbacks-and-timeouts" rel="nofollow">http://www.tornadoweb.org/en/stable/ioloop.html#callbacks-and-timeouts</a>)</p>

<p>So, by examining <code>io_loop._callbacks</code> you can see what yields are in ioloop right now.</p>

<p>Many interesting stuff is here :)  <a href="https://github.com/tornadoweb/tornado/blob/master/tornado/gen.py" rel="nofollow">https://github.com/tornadoweb/tornado/blob/master/tornado/gen.py</a></p>

python tornado