loky
loky copied to clipboard
Feature Request: Awaitable _BaseFuture or result method
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.
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.