Allow setting updated/new env var *values* on Runner.
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- python
- 領域
- performance, tooling
調査の方向性
まず、_utils.py の create_environ()、_master.py の Master.spawn_worker() での使用箇所、そして _runner.py の Runner.init() を読んでください。Runner が明示的な環境値を受け取れるようにする方法を決め、そのうえで、ベンチマークコードが os.environ を変更しなくてもワーカーがそれらの値を受け取れるようにしてください。既存の inherit-environ の動作についても引き続き考慮する必要があります。
索引モデルが issue の本文から書いたものです。
説明
In _utils.py the create_environ() helper produces a dict that can be passed as the "env" arg to subprocess.run(), etc. It is used in Master.spawn_worker() (in _master.py). Currently it takes an "inherit_environ" arg (Bool) that corresponds to the "--inherit-environ" flag in the Runner CLI (see Runner.init() in _runner.py). This results in a potentially problematic situation.
The Problem
Let's say you have a benchmark script that internally relies on some environment variable that is defined relative to the commandline args given to the script. This environment variable may be set already or it might not. Regardless, you will be setting it to some new value. To make this work you need to do something like the following:
# This is a concrete example.
os.environ["MY_VAR"] = "spam" if runner.args.my_flag else "eggs"
if runner.args.inherit_environ is None:
runner.args.inherit_environ = ["MY_VAR"]
else:
runner.args.inherit_environ.append("MY_VAR")
However, in some cases you can't leave the env var set (or maybe the env var could cause pyperf to break). Plus things are more complicated if you have more than one such env var.
The Solution
Consequently, in a benchmark script it would be nice to be able to give the actual env var pairs to Runner rather than doing the dance above. Here are some possible approaches to solve the problem:
- allow
Runner.args.inherit_environto be a dictcreate_environ()would be updated to do the right thing- this is probably too messy to be part of pyperf's public API
- add something like
Runner.env_varsto allow benchmarks to explicitly set env var values to be used in workerscreate_environ()would grow a new "env" arg or "inherit_environ" would updated as above
- add
Runner.add_env_var(name, value=INHERIT)- this is like either of the two above, but probably a better public API for the functionality
- 主要言語
- Python
- スター
- 967
- フォーク
- 112
- 平均マージ
- 5日 8時間
- マージ済み PR(30日)
- 9
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
psf/pyperf のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
Improve Type System for `pyperf`対応中かも @DebanKsahu が 69 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 32/100
メンテナーはふだん 1 日以内に返信
-
Extend hook's teardown metadata with warmup/calibration flags対応中かも @maurycy が 170 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
add entry to blockオープン
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
StevenBlack/hosts#3299 ·
-
`garak --report` overwrites the input report when its name has no ".report"対応中かも @0z5a が今日担当しました。 オープンneeds-triage
難易度 2/5 半日 初心者へのやさしさ 72/100
メンテナーはふだん 2 日以内に返信
-
plot_graph crashes when a mesh node has no m2m edge対応中かも @tygvi が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
mllam/neural-lam#883 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
future-agi/future-agi#4092 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
transcript analytics: a text whose only protected spans the prose pass redacts is withheld wholeオープン
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
WingedGuardian/GENesis-AGI#4641 ·
メンテナーはふだん 1 日以内に返信