Skip to content

future: value(fs) is better than lapply(fs, value) #798

@HenrikBengtsson

Description

@HenrikBengtsson

Hello, these days, as the author of Futureverse, I recommend to use:

 ys <- value(fs)

instead of:

 ys <- lapply(fs, value)

One reason is that it value(fs) on a set of futures fs supports early stopping in case of errors and interrupts. For instance, if the user interrupts the processing, value(fs) will cancel all active futures, which results in value(fs) exiting much sooner. Same happens if one of the futures result in an error -- all other futures will be canceled and then the error is produced. This will not happen when using lapply(fs, value).

Here's one example where you could update your code accordingly:

samplers <- lapply(samplers, future::value)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions