-
Notifications
You must be signed in to change notification settings - Fork 2
Description
This is a dedicated issue for the discussion in jupyterhub/nbgitpuller#194 (comment) surrounding the following code snippet.
import nest_asyncio
# this allows us to nest usage of the event_loop from asyncio
# being used by tornado in jupyter distro
# Ref: https://medium.com/@vyshali.enukonda/how-to-get-around-runtimeerror-this-event-loop-is-already-running-3f26f67e762e
nest_asyncio.apply()Goal
-
Clarify what made us need a workaround like nest_asyncio in the first place.
I currently don't have a good grasp of where in the codebase we end up erroring without nest_asyncio.apply() called ahead of time.
@sean-morris can you provide some more details on this?
-
Get a recommendation and go with it
I figure we should ask Min RK on the use of this workaround.
It is my understanding that by using it, we modify asyncio core functionality and my main concern would be if just installing
nbgitpullerautomatically would lead to making a change that breaks other code. Before doing this, I figure we just try to clarify and pinpoint what code, and where, makes us need to need the workaround. I'd like to have it more explicit wherever we declare to use it. -
If we go with the workaround: decide on location in codebase
We decide on the location. It just need to run once, and it can run from anywhere. So, perhaps a init.py file not related to a specific plugin makes the most sense. I think it can be in ngitpuller also if the most primitive structure that all plugins will need requires it also, and, a plugin has been detected.
Mainly I'd like to avoid having it in nbgitpuller in situations when users don't even use plugins.