[Bug]: WorkflowProfiler reports zero elapsed time on Windows with Python <= 3.12
メンテナーはふだん 5 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 38/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- python
調査の方向性
Start with WorkflowProfiler in profiling.py, total_runtime in run_pipeline.py, and tests/unit/indexing/test_profiling.py; check how elapsed time is measured and run the profiling tests on Windows with Python 3.11 or 3.12. Done means short workflows report positive elapsed time and pipeline runtime remains monotonic. The issue author says a fix and regression test are ready and that they plan to open a pull request, so check for work already underway before starting.
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
WorkflowProfiler (and the pipeline total_runtime in run_pipeline.py) measure elapsed time with time.time(). On Windows, time.time() has a 15.6 ms resolution with Python <= 3.12 (it uses GetSystemTimeAsFileTime); CPython 3.13 switched to GetSystemTimePreciseAsFileTime with a 1 microsecond resolution (What's New in Python 3.13 - time).
Since pyproject.toml declares requires-python = ">=3.11,<3.14" but the unit-test CI matrix only runs Python 3.13, this bug is invisible to CI and affects every Windows user on Python 3.11/3.12:
context.stats.workflows[name] = profiler.metricswritesoverall = 0.0for any workflow body shorter than one scheduler tick, sostats.jsonreports 0 ms per workflow on Windows with Python 3.11/3.12.tests/unit/indexing/test_profiling.py::TestWorkflowProfiler::test_handles_exception_in_contextfails deterministically (assert 0.0 > 0), because the test body is microsecond-scale.time.time()is also a wall clock, so NTP adjustments can makeelapsed/total_runtimenegative or inflated;time.perf_counter()is the documented clock for measuring elapsed durations.
Steps to reproduce
On Windows with Python 3.11 or 3.12:
uv sync --all-packages
uv run pytest tests/unit/indexing/test_profiling.py
test_handles_exception_in_context fails with assert 0.0 > 0 on both 3.11.15 and 3.12.4 (verified: 11/11 pytest runs across both versions). A 300-iteration measurement of the exact try/with/raise block used by the test reports 298/300 zero elapsed values (99.3%), median 0.0, max 1.0 ms. The same test passes on Python 3.13 (3/3), which is exactly why the CI matrix (Python 3.13 only x ubuntu/windows) stays green while the supported versions fail.
Minimal clock probe on Windows, Python 3.12.4:
import time
zero = sum(
(lambda t0: ([0] * 1000, time.time() - t0)[1] == 0.0)(time.time())
for _ in range(200)
)
# -> 200/200 zero samples for a microsecond-scale body
Expected Behavior
WorkflowProfiler.overall and pipeline.total_runtime must be positive and monotonic regardless of Python version or OS. Elapsed-time measurement should use time.perf_counter() (high-resolution monotonic clock), per the Python docs recommendation for benchmarking.
GraphRAG Config Used
Not config-dependent; reproducible with the unit test suite alone.
Logs and screenshots
FAILED tests/unit/indexing/test_profiling.py::TestWorkflowProfiler::test_handles_exception_in_context - assert 0.0 > 0
+ where 0.0 = WorkflowMetrics(overall=0.0, peak_memory_bytes=8480, memory_delta_bytes=8480, tracemalloc_overhead_bytes=1104).overall
Additional Information
- GraphRAG Version: main (5faaaf4f5, post-3.3.0)
- Operating System: Windows 11 (24H2, x64)
- Python Version: 3.11.15, 3.12.4 (failing), 3.13.x (passing)
- Related Issues: none found for this failure mode
I have a minimal fix ready (time.perf_counter() in profiling.py + run_pipeline.py, plus a regression test guarding positive elapsed time for sub-tick bodies) and will open a PR referencing this issue.
- 主要言語
- Python
- スター
- 36.6k
- フォーク
- 3.9k
- 平均マージ
- 4日 11時間
- マージ済み PR(30日)
- 1
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/graphrag のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
microsoft/graphrag#2626 · コメント 1 件 ·
メンテナーはふだん 5 日以内に返信
-
[Bug]: response_format_json_object=True is silently dropped, so JSON mode never reaches the modelオープンbug triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
microsoft/graphrag#2625 · コメント 1 件 ·
メンテナーはふだん 5 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
メンテナーはふだん 5 日以内に返信
-
[Bug]: JsonCache.get() crashes with unhandled AttributeError on non-dict or invalid envelope JSON payloads再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
microsoft/graphrag#2614 · コメント 2 件 ·
メンテナーはふだん 5 日以内に返信
-
[Bug]: JSONLinesFileReader drops rows containing U+2028, U+2029 or U+0085 (uses str.splitlines)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
microsoft/graphrag#2594 · コメント 1 件 ·
メンテナーはふだん 5 日以内に返信
microsoft/graphrag の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
deepchem/deepchem#5289 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 60/100
UKGovernmentBEIS/inspect_evals#2892 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Versioning docs: say that no output from the 0.46 warning check means nothing is affected対応中かも @grelinfo が今日担当しました。 オープンdocumentation priority:low size:S
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
alphacrack/readme2demo#293 ·