`future` unable to export libraries of list encapsulated functions
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- r
调研方向
使用 plan(multisession, workers = 2) 运行提供的 R 重现代码,重点关注 future::future(wrapper(1)) 和列表中持有的函数。跟踪 future 如何为此嵌套调用检测 globals 和包;当示例能够解析 lubridate's days() 且不再出现缺少函数的错误时,即完成。
由索引模型根据 Issue 内容生成。
描述
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)
- 主要语言
- R
- 星标
- 1k
- 派生
- 93
- 平均合并
- 2 天 4 小时
- 30 天内合并 PR
- 1
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
futureverse/future 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
futureverse/future#852 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 35/100
futureverse/future#849 ·
-
bug
难度 4/5 3-5 天 新手友好度 48/100
futureverse/future#833 ·
-
feature/resources RNG
难度 5/5 一周以上 新手友好度 35/100
futureverse/future#832 ·
-
RNG
难度 5/5 一周以上 新手友好度 38/100
futureverse/future#831 · 1 条评论 ·
查看 futureverse/future 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 90/100
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 88/100
nf-core/provenancereport#75 ·
-
难度 1/5 1 小时以内 新手友好度 95/100
-
难度 1/5 1 小时以内 新手友好度 72/100
garner-code/PsyR#80 ·