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

Alternative to nest-asyncio: threading #135

Open
davidbrochart opened this issue Feb 17, 2021 · 0 comments
Open

Alternative to nest-asyncio: threading #135

davidbrochart opened this issue Feb 17, 2021 · 0 comments

Comments

@davidbrochart
Copy link
Member

Because nbclient's code is natively asynchronous, we provide wrappers to run async code synchronously for its blocking API. We currently use nest-asyncio to run coroutines until they complete in the current event loop (here). While this works well most of the time, it also comes with limitations, because nest-asyncio patches asyncio's code. I don't think it would work if someone decided to use uvloop for instance.
One alternative is to run coroutines in an event loop running in another thread. @SylvainCorlay experimented with it in #113, and fsspec also uses this approach here. I think we should provide a way to choose between nest-asyncio and the threading solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant