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

オープン
#774 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
38/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
r

調査の方向性

まず nbrOfFreeWorkers() のエントリポイントを見つけ、登録された futures、ワーカーの可用性、解決済みの結果がどのように追跡されているかを読み取ります。issue に記載されたノンブロッキングなクリーンアップの動作を確認し、解決済みの futures が回収された後に利用可能なワーカーを返すことを完了と定義します。ただし、解放できるものがない場合は引き続き 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時間
マージ済み PR(30日)
1

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

futureverse/future のほかの issue

futureverse/future の issue をすべて見る

似ている issue

R の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。