Non-block batch assigns

未关闭
#307 12 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
r

调研方向

先阅读 future::futureAssign 以及本 issue 中的 lapply 风格示例,然后检查 multicore 计划如何处理超出 worker 限制的工作。定义对于排队中的 futures,非阻塞提交和提前看到赋值应当意味着什么,并验证所提议的行为是否允许调用方在结果变得可用的同时继续执行。

由索引模型根据 Issue 内容生成。

描述

Hi, I have a project which requires loading of ~30GB data (~100 segments with each 300MB) into RAM, which is super time-consuming. The application only requires 5 segment of data to start analysis. I was wondering if future package can support non-blocked batch assignment. Basically lots of future::futureAssign in lapply way but non-blocking.

Right now if I use multicore plan, and set max worker number to be 8, then the 9th future will block the session. However, it could be best if this procedure is non-blocking. I implemented an ugly version using future and later packages, but you must have better idea of doing so.

The idea:

future::plan(future::multiprocess)

a = new.env(parent = baseenv())
b = new.env(parent = baseenv())
a$plus = 10

# For each element of x, assign corresponding letter character to environment b with el + 10
NONBLOCKING_lapply(
  x = 1:26, varnames = LETTERS[1:26], {
    Sys.sleep(3)
    return(el + plus)
  }, nworkers = 2, envir = a, assign.env = b
)
Sys.sleep(3)

# Yay, I can start to view A in environment b at once
b$A
# >> 11
主要语言
R
星标
1k
派生
93
平均合并
2 天 4 小时
30 天内合并 PR
1

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

futureverse/future 的其他 Issue

查看 futureverse/future 的全部 Issue

相似的 Issue

更多 R Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。