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

Document how to allow blocking requests when asyncio is running #109

Closed
gadomski opened this issue Sep 22, 2023 · 2 comments · Fixed by #111
Closed

Document how to allow blocking requests when asyncio is running #109

gadomski opened this issue Sep 22, 2023 · 2 comments · Fixed by #111
Labels
documentation Improvements or additions to documentation
Milestone

Comments

@gadomski
Copy link
Member

gadomski commented Sep 22, 2023

Some environments, e.g. notebooks, spin up an asyncio runtime for you. Right now, this leads to breakages if you try to use stac_asset.blocking.* functions, since we use asyncio.run. We should update the blocking functions to use an existing runtime if possible, and only fall back to asyncio.run if need be.

Fixing this feels out-of-scope, so we should just document the usage of nest_asyncio.

@gadomski gadomski added the bug Something isn't working label Sep 22, 2023
@gadomski gadomski self-assigned this Sep 22, 2023
@gadomski gadomski added this to the v0.2.3 milestone Sep 22, 2023
@gadomski gadomski removed the bug Something isn't working label Sep 22, 2023
@gadomski gadomski changed the title Allow blocking requests when asyncio is running Document how to allow blocking requests when asyncio is running Sep 22, 2023
@gadomski gadomski added the documentation Improvements or additions to documentation label Sep 22, 2023
@AdeelH
Copy link

AdeelH commented Sep 29, 2023

I ran into this the other day too. Looks like simply calling nest_asyncio.apply() is sufficient (example).

I'd be happy to make a PR for this. Is adding a note in the README good enough?

@gadomski
Copy link
Member Author

Yeah, for now a README note would be great, thanks so much! For reference, this is how I ended up using it, similar to yours: https://github.com/stac-utils/stac-task/pull/42/files#diff-0ed2cf4aaeba2d2a23f6230accc39f7aedcf80e0feea2a89639c7633282f293aR148-R156.

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

Successfully merging a pull request may close this issue.

2 participants