nbrOfFreeWorkers(): Automatic attempt to free up a worker, if there are no free workers left

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

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
38/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
r

调研方向

首先定位 nbrOfFreeWorkers() 入口点,并阅读已注册的 future、worker 可用性和已解析结果是如何被跟踪的。验证 issue 中描述的非阻塞清理行为,并将完成定义为:在收集已解析的 future 后返回一个可用的 worker;如果没有任何 worker 可以释放,则仍返回 0。

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

描述

Distilled from https://github.com/futureverse/future.callr/issues/20:

Although rare, and probably a mistake, there are ways to end up with nbrOfFreeWorkers() == 0, even when some of the active futures have been resolved. In such cases, code that rely on nbrOfFreeWorkers() to decided whether to create another future might end up in a deadlock, e.g.

if (nbrOfFreeWorkers() > 0) f <- future(...)

To account for such use as well, nbrOfFreeWorkers() could attempt an internal cleanup of registered futures in case there are no free workers available. Only if there are no free workers after such a cleanup, it should return 0. Note that the internal cleanup will not block; it will check if any of the registered futures are resolved, and if one is, then its results are collected, allowing us to remove that future from the internal registry freeing up one worker.

/ht @randy3k

主要语言
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 摘要。