Note: This behavior has changed in Tornado 4.1
Executing python yield_all.py
will produce results similar to:
$ python run_all.py
one is sleeping
two is sleeping
three is sleeping
four is sleeping
Beginning yield
four is raising exception!
two is raising exception!
three is raising exception!
one is raising exception!
Traceback (most recent call last):
File "run_all.py", line 48, in <module>
ioloop.IOLoop.instance().run_sync(raise_many)
File "run_all.py", line 30, in raise_many
yield tasks
File "run_all.py", line 18, in raise_exception
raise Exception('Bad things from %s' % name)
Exception: Bad things from one
Note two important things:
- "Beginning yield" starts after the sleeping has been initiated.
- The traceback you see is always from one and not from a random name.