Handling tasks that produce results
See original GitHub issueI don’t see an equivalent of asyncio’s wait(return_when=FIRST_COMPLETED)
API in anyio. Is that a deliberate omission, and if so, how should I write code that runs background tasks and processes the results as they arrive? More generally, the documentation doesn’t seem to cover getting the return value of a task at all.
Is the intention that tasks only return values via streams? For my use cases, streams seem very heavyweight - or am I missing something?
It’s quite likely that this is a documentation issue rather than a functionality issue, and it may even be that all that is needed is for beginners to be pointed at a “how to get started thinking in terms of async” document. But I’m struggling to find such a thing, and I feel like I’m ending up writing my own low-level utilities, when I expected async to let me focus more on the higher level tasks.
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (3 by maintainers)
Top GitHub Comments
Btw there’s
with anyio.open_signal_reciever() as channel:
that might helpI really shouldn’t be writing code when I’m sleepy. I’ll amend it to actually help with the requested task.