-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add waitany and waitall functions to wait multiple tasks at once #53341
Conversation
de88bfd
to
e863078
Compare
e863078
to
1bd4973
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems quite great. It has got lots of annoying details if anyone was trying to emulate it themself, but seems fairly straightforward internally once you work out those details. I think we are ready to merge it, unless there is anything else of concern with it from anyone? One observation I might suggest is that we add another flag throw
(related to failfast) that defines whether it should fail with CompositeException
when exception
is set (independent of failfast)?
This may also be a good drop-in replacement for the Experiment.sync_end
implementation, with waitall and failfast, which may be a good demo of it in use?
fdf48c5
to
6c610d1
Compare
aafe8f8
to
5728794
Compare
db5ef50
to
dace55a
Compare
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
4b35a76
to
0a382a3
Compare
Thanks for all the persistence and effort here @mrkn! Really great to get this in! |
Adding backport to 1.11 because we want this in 1.11 for #54674 |
#54760 means we no longer need |
I would like to propose adding two functions,
waitany
andwaitall
, discussed in the issue #53226. These functions wait for multiple tasks at once. Thewaitany
function blocks until one task finishes. Thewaitall
function blocks until all tasks finish. There is an optional keyword argument,failfast
, for thewaitall
function. The default offailfast
isfalse
. Thewaitall
function will immediately stop if any task ends with an exception when thefailfast
istrue
.This is my own implementation, but I have regrets about the type of the first argument. I wanted to represent a container type from which
Task
objects can be taken out using theiterate
function, but it seems impossible in current Julia, so I used a union type ofAbstractVector
,Tuple
, andSet
. I would like to know if there is a better way to write this part.