Skip to content
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

Add some nest_asyncio insurance #823

Closed
wants to merge 4 commits into from
Closed

Conversation

vidartf
Copy link
Contributor

@vidartf vidartf commented Aug 18, 2022

Builds on #822 in order to help fix jupyterlab/jupyterlab#11934.

Adds a decorator to classes that uses run_sync, so that it will attempt to patch in nest_asyncio before the methods gets called. This is done in the naive belief that the time of some of the __init__ calls are more likely to be closer to the init of the loop. It also only applies the patch if a sync class is actually instantiated, and has minimal overhead for async classes.

A rather blunt instrument, but also rather hard to solve generically without putting weird restrictions on consumers of jupyter-client. The other alternative is to have jupyter_server always import nest_asyncio and call the patch, even if run_sync is never called.

vidartf and others added 4 commits September 1, 2022 16:06
This does not guarantee a convenient patch time, but has a much higher chance of hitting the right timing. It also only applies the patch if a sync class is actually instantiated, and has minimal overhead for async classes.

A rather blunt instrument, but also rather hard to solve generically without putting weird restrictions on consumers of jupyter-client.
@vidartf vidartf marked this pull request as ready for review September 1, 2022 15:08
@blink1073
Copy link
Contributor

Closing in favor of removing nest-asyncio altogether in #835

@blink1073 blink1073 closed this Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failure to start jupyter lab --- IndexError: pop from an empty deque
2 participants