DavisVaughan / furrr

Apply Mapping Functions in Parallel using Futures
https://furrr.futureverse.org/
Other
695 stars 39 forks source link

Would future::plan() work if embedded in a function? #237

Closed EvoLandEco closed 2 years ago

EvoLandEco commented 2 years ago
### case 1
fun_that_sets_plan <- function(strategy, workers) {
    future::plan(strategy, workers)
}
furrr::future_map(things)
###

### case 2
future::plan(strategy, workers)
furrr::future_map(things)
###

I would like to know if case 1 works as case 2, that I put future::plan inside another function?

jinyancool commented 2 years ago

I donot think that case 1 works as case 2. But it will be easy test it.

EvoLandEco commented 2 years ago

@jinyancool I tried and it worked, It would be much appreciated if you could also try and confirm it