tidyverts / fabletools

General fable features useful for extension packages
http://fabletools.tidyverts.org/
89 stars 31 forks source link

Parallelisation only happens when `future` is attached than loaded #363

Open FinYang opened 2 years ago

FinYang commented 2 years ago

https://github.com/tidyverts/fabletools/blob/9794d225a37e79aaab18655692eca54bb3e1aed7/R/model.R#L100

future::plan(future::multisession)
rlang::is_attached("package:future")
#> [1] FALSE
library(future)
rlang::is_attached("package:future")
#> [1] TRUE

Created on 2022-06-27 by the reprex package (v2.0.1)

Is this an intended behaviour? It took me some time to figure out why future::plan(future::multisession) does not work since the documentation does not require future to be attached. I thought it was something wrong with my future.

https://github.com/tidyverts/fabletools/blob/9794d225a37e79aaab18655692eca54bb3e1aed7/R/model.R#L27-L30

Wouldn't it be better to check if the future::plan is future::sequential when future is loaded rather than to check if it is attached? It would be nice to have the option to run it in parallel without ever putting future onto the search path.