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

gather drop-in replacement #41

Open
prophile opened this issue Aug 25, 2023 · 3 comments
Open

gather drop-in replacement #41

prophile opened this issue Aug 25, 2023 · 3 comments

Comments

@prophile
Copy link

prophile commented Aug 25, 2023

Hello!

asyncio's own gather is a bit of a dated design but still pretty common, at least in codebases I'm dealing with at the moment—converting them to amap would be nice but it would also be dead useful to be able to drop-in replace with an aiometer.gather in a like-for-like fashion to add metering separately.

It's not impossible to shim on top of amap but would it be something you'd consider bringing into scope in the library itself? Especially since the exception handling semantics of gather can be a bit subtle.

@florimondmanca
Copy link
Owner

florimondmanca commented Aug 25, 2023

Hi @prophile

This is interesting at first, but I’m not sure.

Like you said, gather has its own quirks. For example, I believe it’s possible to pass a flag that changes its behavior quite substantially.

The library already has run_all and run_any helpers which build on top of amap. Don’t those do the trick?

@prophile
Copy link
Author

Potentially yes, and switching over to them would be an aspiration. But changing something from using asyncio.gather to aiometer.run_all isn't necessarily drop-in in the sense that things might rely on asyncio.gather's peculiarities and changing them might cause a breakage.

For me (us) I think that's useful to do, but it would also be useful to get metering in the short term before doing the bigger job of changing over to run_all.

@florimondmanca
Copy link
Owner

florimondmanca commented Aug 26, 2023

I think I understand where you’re at, but let me rephrase this.

What piece of public API do you think we could add to aiometer that would address this use case? If we were to add a gather « like for like but with metering », what would be its signature and a few code usage examples?

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

2 participants