question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Handling tasks that produce results

See original GitHub issue

I 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:closed
  • Created 2 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
graingertcommented, Jul 3, 2021

Btw there’s with anyio.open_signal_reciever() as channel: that might help

1reaction
agronholmcommented, Jul 3, 2021

I really shouldn’t be writing code when I’m sleepy. I’ll amend it to actually help with the requested task.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Improve Your Task Management Skills | Wrike
Managing your tasks helps you organize, prioritize, and coordinate all you have to do, especially when working with a team.
Read more >
12 Effective Task Management Strategies for Modern-day ...
Looking for task management strategies to keep your teams productive? This article sheds light on some tried and tested strategies that can work...
Read more >
How to Manage Tasks Effectively? 10 Tips for Effective ... - nTask
1. Make To-do Lists · 2. Prioritize · 3. Schedule · 4. Be Flexible · 5. Manage Change · 6. Delegate · 7....
Read more >
3 Tiny Things You Can Do to Produce Big Results in Your Work
1. Promise yourself a reward after doing work. · 2. Break the task down into smaller chunks. · 3. Give yourself a mental...
Read more >
Task Management Skills: Definition and Examples | Indeed.com
Deciding which tasks to prioritize and how long it may take to perform them is not always a straightforward decision. Being able to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found