Nested Futures #545
-
Hi Henrik, Thank you for the awesome package. It is such an elegant and powerful way to parallelize. I have a question regarding nested parallelization. I am developing some functions which can be simplified to
I can then call the function sequentially while the function itself is processed asynchronously without any problems:
However it would be great if I could also run calls b, c, and e in parallel. I am trying to do this as shown below:
However I get the error in your Common Issues Vignette:
Here is my session info:
Any help would be much appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You can't pass futures between processes, so you can't create ( fun_a <- function(x){
a <- list()
for(i in 1:x){
a[[i]] <- future(Sys.sleep(5))
}
value(a)
} or, equivalently using implicit future assignments syntax: fun_a <- function(x){
a <- listenv()
for(i in 1:x){
a[[i]] %<-% Sys.sleep(5)
}
as.list(a)
} See also https://future.futureverse.org/articles/future-3-topologies.html |
Beta Was this translation helpful? Give feedback.
You can't pass futures between processes, so you can't create (
future())
them in a parallel worker and ask them to be resolved (value()
) in another. Instead, use:or, equivalently using implicit future assignments syntax:
See also https://future.futureverse.org/articles/future-3-topologies.html