Based on discussion in https://github.com/python/cpython/issues/100160, we should not be relying on asyncio.get_event_loop, since they are in fact going to make it an alias for asyncio.get_running_loop.
Additionally, it adds a new class, JupyterAsyncApp that runs initialize_async() and start_async() in an event loop.
Based on results in https://github.com/ipython/ipykernel/pull/1184, we'll want to normally use the default event loop on Windows, unless we know we're running a tornado app. This PR adds a prefer_selector_loop option to ensure_event_loop so we can override _prefer_selector_loop in jupyter_server apps to prefer the selector loop.
Based on failures seen in #383, we add tests to ensure we are not interfering with existing event loop behavior.
Based on discussion in https://github.com/python/cpython/issues/100160, we should not be relying on
asyncio.get_event_loop
, since they are in fact going to make it an alias forasyncio.get_running_loop
.This ensures we install an event loop before launching our apps, so we should not see any more issues like https://github.com/jupyter/notebook/issues/6721.
Additionally, it adds a new class,
JupyterAsyncApp
that runsinitialize_async()
andstart_async()
in an event loop.Based on results in https://github.com/ipython/ipykernel/pull/1184, we'll want to normally use the default event loop on Windows, unless we know we're running a tornado app. This PR adds a
prefer_selector_loop
option toensure_event_loop
so we can override_prefer_selector_loop
injupyter_server
apps to prefer the selector loop.Based on failures seen in #383, we add tests to ensure we are not interfering with existing event loop behavior.