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

[qob] fix use of nest_asycnio #12413

Merged
merged 2 commits into from
Nov 4, 2022
Merged

Conversation

danking
Copy link
Contributor

@danking danking commented Nov 2, 2022

As of nest_asyncio 1.5.2, we can initialize nest_asyncio inside running loops (e.g. Jupyter). If nest_asyncio is initialized after even one task is created, users receive inscrutable errors. This error happened during the QoB workshop I ran. This change takes advantage of nest_asyncio 1.5.2 to initialize nest_asyncio before everything, thus ensuring it can completely patch the event loop.

You can reproduce the error yourself by running python3 -c "import hail as hl; hl.init(billing_project=\"not-a-real-billing-project\")" repeatedly in a terminal. I encounter the error ~50% of the time. With this change, I did not see the error after 5 invocations of that command.

As of [nest_asyncio 1.5.2](erdewit/nest_asyncio@1856573), we can initialize nest_asyncio inside running loops (e.g. Jupyter). If nest_asyncio is initialized after even one task is created, [users receive inscrutable errors](https://github.com/erdewit/nest_asyncio/issues/22\#issuecomment-874710264). This error happened during the QoB workshop I ran. This change takes advantage of nest_asyncio 1.5.2 to initialize nest_asyncio before *everything*, thus ensuring it can completely patch the event loop.

You can reproduce the error yourself by running `python3 -c "import hail as hl; hl.init(billing_project=\"not-a-real-billing-project\")"` repeatedly in a terminal. I encounter the error ~50% of the time. With this change, I did not see the error after 5 invocations of that command.
Copy link
Collaborator

@chrisvittal chrisvittal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to fix/ignore the lints, but good otherwise

@danking danking merged commit 726b22e into hail-is:main Nov 4, 2022
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

Successfully merging this pull request may close these issues.

2 participants