Conditional gather?
See original GitHub issueIf I would like to gather the result of parallel computations that have finished (not those that have thrown an error, or are still in computation), I would write cod that does this:
scores = dict()
for assay, score_future in scores_futures.items():
if score_future.status == 'finished':
scores[assay] = client.gather(score_future)
Would it be of interest, and would it also make sense or not (I’m open to this not being a sensible thing), to have this wrapped in a client.gather_finished(futures)
class method? Some of my parallel computations take a long time, while others finish up pretty quickly, so being able to gather just the finished jobs and continue prototyping, while allowing myself to come back later and gather everything later, might be of use, I think.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
How to have conditional logic within asyncio.gather?
You can create a function async def await_none(): return None. And then change your code to some_async_method2() if some_condition else ...
Read more >Gather The Right Data, Faster with Conditional Fields
Our all-new conditional fields allow you to create documents that automatically adjust to your customer's individual needs.
Read more >Gather columns into key-value pairs - tidyr - Tidyverse
Names of new key and value columns, as strings or symbols. This argument is passed by expression and supports quasiquotation (you can unquote...
Read more >Conditionals - Ansible Documentation
The simplest conditional statement applies to a single task. ... tasks: - name: Gather site specific fact data action: site_facts - name: Use...
Read more >Conditional Login, gather extra user data - Auth0 Community
Problem Due to business requirements, we would need to be able to conditionally gather additional information from a user depending on which ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The
as_completed
object is able to be used in a non-blocking fashion. For example:Hope this helps. The docs could maybe be improved. Check out the source code:
http://distributed.dask.org/en/latest/_modules/distributed/client.html#as_completed
Yes, I suppose you are right. Your loop is simple enough, and seems it works well - I don’t suppose it’s designed to be run too often.
There may be interest in supplying this convenience method. I would recommend proposing a PR with clear docstring and tests (some futures don’t finish for a long time, some error).