Scope of future plan
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- r
调研方向
首先检查 plan() 和 future() 的行为,包括 issue 中提到的 persistent=TRUE 选项,然后阅读链接的 future 后端规范。确定是否支持在相互独立的 Shiny 会话中使用会话作用域的计划和集群状态,并通过一个预期行为示例记录所需的更改或界定其范围。
由索引模型根据 Issue 内容生成。
描述
Hi,
Is it possible to have a plan being valid in a specific scope of a R session only, i.e. to have multiple plans in the same R session?
I know it is possible to specify the workers for the plan, but is it possible to have multiple plans? future({}) does not seem to have an option for specifying a plan either.
cl <- parallel::makePSOCKcluster(1L,rscript_libs='E:/rpackages')
parallel::clusterEvalQ(cl, { .libPaths('E:/rpackages') })
plan(cluster, workers = cl)
The reason I'm asking is because I would like to have separate plans/clusters for different shiny sessions that run in the same R process. The workers of the clusters need to do some setup and I'd like that to be specific to the user session only.
The idea I would have had was to rerun the plan() command before each future call, but that could mess up the promises later in the event loop?
Edit: Attached to the same question ("linking a cluster to a session") I wanted to ask whether it is possible to keep the state of a cluster after a future. I tried to assign objects to the global environment but in the following future run they all seem gone. This makes sense in the paradigm of futures being indifferent to who calls them, but as said my goal is to link a specific cluster to a session (and e.g. keep some base data in the cluster which I don't want to re-query each time).
I potentially could re-implement it with https://cran.r-project.org/web/packages/future/vignettes/future-6-future-api-backend-specification.html but I was hoping there is some trick/setting that I'm just not aware of.
It looks like constantly using the persistent=TRUE flag works in f <- future({...},persistent=TRUE). Found it by looking at the source code. Please let me know if this is not the right way to do it / think about it.
Best regards
- 主要语言
- 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 ·