r - 尝试调整多会话计划时,R furrr 计划返回错误?
问题描述
我正在尝试设置我需要的计划,但出现以下错误:
no_cores <- availableCores() - 2
plan(multisession, workers = no_cores, lazy = T, gc = T)
错误是:
Error in MultisessionFuture(expr = expr, envir = envir, substitute = FALSE, :
argument "expr" is missing, with no default
或者:
plan(multisession, workers = no_cores, lazy = T, gc = T)
Error in tweak.future(function (expr, envir = parent.frame(), substitute = TRUE, :
Future argument 'lazy' must not be tweaked / set via plan()
请告知如何设置/ 计划的workers
,lazy
和gc
其他参数。multisession
multicore
我的 R 版本是:
R.Version()
$platform
[1] "x86_64-pc-linux-gnu"
$arch
[1] "x86_64"
$os
[1] "linux-gnu"
$system
[1] "x86_64, linux-gnu"
$status
[1] ""
$major
[1] "4"
$minor
[1] "0.2"
$year
[1] "2020"
$month
[1] "06"
$day
[1] "22"
$`svn rev`
[1] "78730"
$language
[1] "R"
$version.string
[1] "R version 4.0.2 (2020-06-22)"
$nickname
[1] "Taking Off Again"
解决方案
尝试您的示例,我收到了第二条错误消息。而且我基本上遵循了给出的建议:您设置了lazy = T
不允许plan
的参数。但是,您可以直接在furrr
函数调用中设置此参数:
library(furrr)
no_cores <- availableCores() - 2
plan(multisession, workers = no_cores, gc = T)
future_map(c("hello", "world"), ~.x,
.options = future_options(lazy = TRUE))
[[1]]
[1] "hello"
[[2]]
[1] "world"
推荐阅读
- vue.js - 使用 Vuex,为什么 mapGetters 不接受与 mapState 相同的语法?
- docker - PACT.Net 无法分配请求的地址
- javascript - 滚动条显示在其他内容上
- python - 较新版本的 Cython Numpy 扩展编译失败
- java - 从文本文件中读取行,并通过将行中的值写入新的文本文件来按平均值(平均值)对它们进行排序
- sonarqube - 从 VSTS Build 机器在 SonarQube 上发布代码指标时出现错误“Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8”
- amazon-dynamodb - 用户表的 Dynamodb
- cordova-plugins - 在使用 Cordova 的 Android 中应用购买签名验证失败错误
- python - 使用python根据选择条件从json中提取值
- storefront - 如何在 Intershop7 中覆盖渲染 ISML 模板