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

Feature Request: Awaitable _BaseFuture or result method #305

Open
owenlamont opened this issue Oct 26, 2021 · 1 comment
Open

Feature Request: Awaitable _BaseFuture or result method #305

owenlamont opened this issue Oct 26, 2021 · 1 comment

Comments

@owenlamont
Copy link

I was writing to request some way to integrate Loky promises with asyncio logic. I have a current use case with a FastAPI web service composed mainly of async methods but I do have to launch separate processes to handle some requests.

I would love a way to await a Loky future or the future result method.

I can see I can pass a callback to the Future - or as a hacky work around I could create an async sleep loop that polls the done state of the Future - but if there was a more elegant integration that would be fantastic.

I was thinking something like an "aresult" method on the Future to be an awaitable result - but any integration would be fine.

Futures in the generic sense are supposed to be an Awaitable type in asyncio. I don't know if _BaseFuture could be modified to be recognised as an asyncio Awaitable.

@owenlamont
Copy link
Author

I noticed to be recognised as an asyncio Future an object had to be recognised by the asyncio.isfuture function and that requires some _ asyncio_future_blocking attribute.

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