This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Ben.Darnell
Recipients Ben.Darnell, Big Stone, asvetlov, carltongibson, cmeyer, jack1142, lukasz.langa, mikeshardmind, minrk, njs, steve.dower, yselivanov
Date 2021-05-15.19:32:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1621107155.22.0.307254554033.issue37373@roundup.psfhosted.org>
In-reply-to
Content
> It's even slightly easier for tornado, which can reasonably set the proactor-wrapper policy at IOLoop start time, which means `asyncio.get_event_loop()` returns a loop with add_reader. But pyzmq doesn't get invoked until an event loop is already running.

That's not what I'm doing in Tornado; I don't change the policy or the result of get_event_loop. Instead, I call get_event_loop (only once) and wrap its result in AddThreadSelectorEventLoop. This works even while the event loop is already running (which is not an uncommon case; there is no expectation that you use tornado.ioloop.IOLoop.start instead of asyncio.EventLoop.run_forever). 

This relies on the fact that I already have my own thread-local lookup function to retrieve the wrapped event loop; an application that used the more typical asyncio patterns and relied on get_event_loop would indeed have difficulty with this pattern.
History
Date User Action Args
2021-05-15 19:32:35Ben.Darnellsetrecipients: + Ben.Darnell, njs, asvetlov, lukasz.langa, yselivanov, steve.dower, minrk, Big Stone, cmeyer, mikeshardmind, jack1142, carltongibson
2021-05-15 19:32:35Ben.Darnellsetmessageid: <1621107155.22.0.307254554033.issue37373@roundup.psfhosted.org>
2021-05-15 19:32:35Ben.Darnelllinkissue37373 messages
2021-05-15 19:32:35Ben.Darnellcreate