-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make nest_asyncio optional #37
Conversation
Correct me if I'm wrong, but this is also removing one of the more-common user-facing methods |
No, but I agree it looks like it. It's actually monkey-patched with the |
I removed the monkey-patching of |
Trigger CI. |
Trigger CI. |
Another user-facing question from me - does it mean that running this from within Jupyter Notebooks will require using the |
Thanks for you comment @choldgraf, this last commit shows a meaningful message when nesting event loops seems to be needed. |
Nice - I like that, I think it'll be helpful for people that aren't familiar with some of these issues (which unfortunately is probably exactly the kind of person that would be calling |
I'm going to merge this PR soon, if nobody has objections. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, was on vacation and dealing with COVID lockdown so I'm only now catching up on threads. Solution seems fine, just want to preserve comments :)
Welcome back Matthew, I hope you are fine. |
The failing tests are related to #38 (comment), which will be solved when we have a jupyter_client release. |
Use AsyncKernelManager from jupyter_client
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a minor conflict with your other PR I just merged, +1 to merge after the conflict is fixed. I'll see what's left after to keep from #34 and update that PR. Once this and 34 merges I think we can make a release.
test_parallel does fail randomly still ... as I currently understand it there's still a kernel socket race condition (I've fixed a number of them now) in how ports are registered. This might be a jupyter_client issue to track down tackle again.
Yep all good so far, went through some exposed places getting home but no symptoms as of 3 days in. Disconnected from my inbox for a bit was all. |
I will merge this PR soon, if no objection. |
merged |
In nbclient, we chose to implement blocking methods such as
execute
by running their async counterparts (e.g.async_execute
) in an event loop (withasyncio.run_until_complete
), to avoid code duplication. This can be an issue in environments where an event loop is already running, such as a Jupyter Notebook. nest_asyncio solves this issue, but it doesn't play well with tornado (see tornadoweb/tornado#2753). This will impact applications such as Voila (which will use the async methods of nbclient and so won't need to nest event loops). We should for now make the use of nest_asyncio an opt-in.