feat(timing): warmup progress heartbeat and empty-drain guard#1121
feat(timing): warmup progress heartbeat and empty-drain guard#1121ajcasagrande wants to merge 1 commit into
Conversation
Try out this PRQuick install: pip install --upgrade --force-reinstall git+https://github.com/ai-dynamo/aiperf.git@9272320798cbfe0e726f0f9330ff2c7f76811877Recommended with virtual environment (using uv): uv venv --python 3.12 && source .venv/bin/activate
uv pip install --upgrade --force-reinstall git+https://github.com/ai-dynamo/aiperf.git@9272320798cbfe0e726f0f9330ff2c7f76811877Last updated for commit: |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (4)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (3)
WalkthroughAdds a configurable warmup progress log interval, emits throttled warmup heartbeat logs in ChangesWarmup heartbeat and drain timeout fix
Estimated code review effort: 2 (Simple) | ~15 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/aiperf/timing/phase/runner.py (1)
791-809: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winThrottled warmup heartbeat logic looks correct.
Gating on
phase == CreditPhase.WARMUP,warmup_log_interval > 0, andnow >= next_warmup_log_atcorrectly implements throttling and the0-disables semantics from the new setting.No test in this PR exercises
_progress_report_loop's actual gating/throttle behavior (phase check, interval comparison,next_warmup_log_atadvancement) — only_format_warmup_progressand the env field are unit-tested directly. Consider a test that drives a couple of loop iterations with a controlledtime.monotonic()to confirm the heartbeat fires at most once per interval and is suppressed whenWARMUP_PROGRESS_LOG_INTERVAL=0or phase != WARMUP.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/aiperf/timing/phase/runner.py` around lines 791 - 809, Add tests for _progress_report_loop in runner.py that exercise the real throttling behavior, since the current coverage only hits _format_warmup_progress and the env field. Mock time.monotonic() and drive multiple loop iterations through _progress_report_loop to verify the warmup heartbeat is emitted at most once per warmup_log_interval, and that it is suppressed when Environment.SERVICE.WARMUP_PROGRESS_LOG_INTERVAL is 0 or when self._config.phase is not CreditPhase.WARMUP. Use the existing _progress, _phase_publisher, and self.info call sites to assert the gating and next_warmup_log_at advancement logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/aiperf/timing/phase/runner.py`:
- Around line 791-809: Add tests for _progress_report_loop in runner.py that
exercise the real throttling behavior, since the current coverage only hits
_format_warmup_progress and the env field. Mock time.monotonic() and drive
multiple loop iterations through _progress_report_loop to verify the warmup
heartbeat is emitted at most once per warmup_log_interval, and that it is
suppressed when Environment.SERVICE.WARMUP_PROGRESS_LOG_INTERVAL is 0 or when
self._config.phase is not CreditPhase.WARMUP. Use the existing _progress,
_phase_publisher, and self.info call sites to assert the gating and
next_warmup_log_at advancement logic.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 64491c7f-79a7-41df-b06d-fda46adb4355
📒 Files selected for processing (4)
docs/environment-variables.mdsrc/aiperf/common/environment.pysrc/aiperf/timing/phase/runner.pytests/unit/timing/phase/test_runner.py
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Anthony Casagrande <acasagrande@nvidia.com>
4fa9369 to
9272320
Compare
Summary
Carve from the agentx branch: two small, independent improvements to
PhaseRunner.1. Env-gated warmup progress heartbeat (INFO)
Headless/non-interactive runs previously had no observable signal during warmup — progress messages are only consumed by interactive UIs.
_progress_report_loopnow emits a throttled INFO heartbeat during the WARMUP phase:AIPERF_SERVICE_WARMUP_PROGRESS_LOG_INTERVAL(Field on_ServiceSettings, default30.0s,0disables), per the repo rule that tunables live inenvironment.py.docs/environment-variables.mdregenerated viamake generate-env-vars-docs.PhaseRunner._format_warmup_progressstatic helper; target falls back fromfinal_requests_senttototal_expected_requests, and omits the/targetsuffix when neither is known.2. Empty-drain guard in
_wait_for_returning_completeFixes a hang edge on the timeout →
cancel_all_credits()→ drain path: if all credits have already returned by the timeneedis recomputed (need <= 0), nothing will ever setall_credits_returned_event, so the runner waited out the fullCANCEL_DRAIN_TIMEOUTand then force-released "stuck" slots that were never stuck. The guard sets the event immediately whenneed <= 0.Revert-verify evidence (tests run against reverted src): the drain test logs
Need 0 more credits.followed byTimeout waiting 10.0s for cancelled credits to return. ... Forcing phase completion.— exactly the edge this fixes.Pin discipline (revert-verified)
git apply -Rof the src hunks → all 4 new tests FAIL:Re-applied → 4 passed.
Testing
uv run pytest -n auto tests/unit/timing/phase/test_runner.py tests/unit/timing/— 771 passed (no pre-existing failures observed)pytest --collect-only tests/unit/timing/clean (771/778 collected, 7 deselected by markers)ruff format --check/ruff checkclean on all changed filesmake check-ruff-baselined— 0 new;make check-ergonomics— 0 new🤖 Generated with Claude Code
Summary by CodeRabbit
AIPERF_SERVICE_WARMUP_PROGRESS_LOG_INTERVAL(default30s), including an option to disable with0.