-
Notifications
You must be signed in to change notification settings - Fork 92
Open
Labels
Description
Describe the bug
If a function is wrapped in a list then future seems to be unable to detect the libraries used by that function:
library(lubridate)
library(future)
my_a_fun <- function(x) {
zz <- days(3)
x
}
callme <- function(fun) {
obj <- list(funny = fun)
wrapper <- function(x) {
obj$funny(x)
}
future::future(wrapper(1))
}
plan(multisession, workers = 2)
value(callme(my_a_fun))
Error in days(3) : could not find function "days"
Expected behavior
That it would be able to recognise that the lubridate library is required
Session information
Please share your session information after the error has occurred so that we also see which packages and versions are involved;
> sessionInfo()
R version 4.4.1 (2024-06-14)
Platform: x86_64-apple-darwin23.4.0
Running under: macOS Sonoma 14.6.1
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /usr/local/Cellar/r/4.4.1/lib/R/lib/libRlapack.dylib; LAPACK version 3.12.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: Europe/London
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] lubridate_1.9.3 future_1.34.0
loaded via a namespace (and not attached):
[1] compiler_4.4.1 parallelly_1.38.0 generics_0.1.3 parallel_4.4.1 tools_4.4.1 rstudioapi_0.16.0 listenv_0.9.1 codetools_0.2-20
[9] digest_0.6.37 globals_0.16.3 timechange_0.3.0
> future::futureSessionInfo()
*** Package versions
future 1.34.0, parallelly 1.38.0, parallel 4.4.1, globals 0.16.3, listenv 0.9.1
*** Allocations
availableCores():
system
12
availableWorkers():
$system
[1] "localhost" "localhost" "localhost" "localhost" "localhost" "localhost" "localhost" "localhost" "localhost" "localhost" "localhost" "localhost"
*** Settings
- future.plan=<not set>
- future.fork.multithreading.enable=<not set>
- future.globals.maxSize=<not set>
- future.globals.onReference=<not set>
- future.resolve.recursive=<not set>
- future.rng.onMisuse=<not set>
- future.wait.timeout=<not set>
- future.wait.interval=<not set>
- future.wait.alpha=<not set>
- future.startup.script=<not set>
*** Backends
Number of workers: 2
List of future strategies:
1. multisession:
- args: function (..., workers = 2, envir = parent.frame())
- tweaked: TRUE
- call: plan(multisession, workers = 2)
*** Basic tests
Main R session details:
pid r sysname release version nodename machine
1 65511 4.4.1 Darwin 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:13:00 PDT 2024; root:xnu-10063.141.2~1/RELEASE_X86_64 host001 x86_64
login user effective_user
1 user001 user001 user001
Worker R session details:
worker pid r sysname release version nodename
1 1 65631 4.4.1 Darwin 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:13:00 PDT 2024; root:xnu-10063.141.2~1/RELEASE_X86_64 host001
2 2 65632 4.4.1 Darwin 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:13:00 PDT 2024; root:xnu-10063.141.2~1/RELEASE_X86_64 host001
machine login user effective_user
1 x86_64 user001 user001 user001
2 x86_64 user001 user001 user001
Number of unique worker PIDs: 2 (as expected)