xdist master cant see workers' workeroutput when using --forked
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- python
- 領域
- testing-qa
調査の方向性
まず、issue に記載されている pytest_sessionfinish フックと pytest_testnodedown フックを、pytest-forked による --forked の処理および参照されている newhooks.py と併せて追跡します。記載されている Python、pytest、pytest-xdist、pytest-forked のバージョンで再現します。--forked が有効な場合に、pytest_testnodedown 中に worker の統計情報を master が利用できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Hi fellas.
I am building a tests profiler for collecting various statistics before/during test cases execution.
Since we use pytest-xdist, I decided its finally time to look into how new xdist hooks from newhooks.py work and try to get as much value out of them as possible, since doing shenanigans with locks and writing output to tmp files is pretty ugly.
I have finished my profiler MVP, and it was working nicely, until I tried to run it in our jenkins which uses --forked option.
setup
python-3.8.10
pytest-7.4.3
pytest-xdist-3.3.1
pytest-forked-1.6.0
ISSUE
Turned out no stats are being displayed when I use this option.
Inside pytest_testnodedown hook, where master node is collecting and aggregating collected statistics from all worker nodes, the node.workeroutput attribute is simply empty.
Is there some workaround for this, on how to properly send data from workers to master when using --forked? Am I just missing something?
Here are 2 most important hooks used for collecting and aggregating all the statistics.
@pytest.hookimpl(hookwrapper=True, tryfirst=True)
def pytest_sessionfinish(self):
worker_id = get_xdist_worker_id(self)
if worker_id != "master":
# NOTE: Execnet can't serialize custom classes. Serialization has to be
# implemented for everything we want to send in-between master and workers
self.config.workeroutput[
f"{worker_id}-stats"
] = self._profiling_stats.serialize()
yield
@pytest.hookimpl(trylast=True)
def pytest_testnodedown(self, node):
worker_id = node.workerinput["workerid"]
node_stats = node.workeroutput[f"{worker_id}-stats"]
node_stats = ProfilerNamespaceUnit.deserialize(node_stats)
self._profiling_stats.merge_trees(node_stats)
- 主要言語
- Python
- スター
- 83
- フォーク
- 29
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
pytest-dev/pytest-forked のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
pytest-dev/pytest-forked#106 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
pytest-dev/pytest-forked#84 ·
-
Fork per subpath オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
pytest-dev/pytest-forked#94 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
pytest-dev/pytest-forked#88 · コメント 12 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 48/100
pytest-dev/pytest-forked#85 · コメント 3 件 ·
pytest-dev/pytest-forked の issue をすべて見る
似ている issue
-
agent-ready documentation needs-triage
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 91/100
-
workflow-status page template still says reusable workflows are "triggered only by workflow_call:" オープン
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
-
instance instance add
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
searxng/searx-instances#939 · コメント 1 件 ·
-
area-deployment area-integrations triage:bot-seen
難易度 2/5 半日 初心者へのやさしさ 86/100