Repository navigation
[None][test] Scan server logs incrementally while waiting for readiness - #22782
chenfeiz0326 wants to merge 1 commit into
Conversation
wait_for_endpoint_ready re-read every server log in full at each check (every 30 s). In disaggregated perf-sanity e2e runs the benchmark rank polls from another node than the srun that appends the ctx and gen worker logs, on Lustre: each full re-read takes the file's locks away from that srun, which then forwards the ranks' stdout slowly, and a rank whose stdout pipe fills blocks until it drains, with the other ranks waiting for it in their collectives. MiniMax-M3's gen worker logs about 300 MB in its warmup, and its e2e startup lost up to 33 minutes this way. LogScanner keeps each log's scanned offset and line count, so a scan reads only what the log gained since the last one; check_error keeps its full scan. Signed-off-by: chenfeiz0326 <[email protected]>
|
No actionable comments were generated in the recent review. WalkthroughThe change centralizes error-line matching, adds a stateful scanner that reads newly appended log content, and uses one scanner during endpoint-readiness polling. The scanner tracks offsets and line numbers per path and rechecks incomplete trailing lines on the next scan. ChangesIncremental log scanning
Estimated code review effort: 2 (Simple) | ~10 minutes Change: Other Suggested reviewers: Merge Risk:
|
brnguyen2
left a comment
There was a problem hiding this comment.
The before/after table makes a clear case for the incremental scan. Two things should change before merge:
-
Partial trailing line: see the inline comment. Scanning it can false-fail on benign pip-retry lines.
-
No tests for
LogScanner:tests/unittest/others/test_http_utils_fail_fast.pyalready hastmp_pathfixtures forcheck_error. Please add a few cases that append to a log betweenscan()calls, and check:- only new lines are reported, with correct absolute line numbers;
- a line written without its newline is handled (whatever the policy ends up being);
- a pip-retry line split across two scans is not reported;
- a truncated or shrunk log is rescanned from line 1.
Running the existing pip-retry/benign parametrizations against both
check_errorandLogScanner.scanwould lock in parity cheaply.
| # A last line without its newline is checked now, and read again once it is complete. | ||
| complete = data.rfind(b"\n") + 1 | ||
| lines = _text_lines(data[:complete]) | ||
| error_lines = _error_lines(lines, num_lines + 1) |
There was a problem hiding this comment.
Scanning the unfinished last line can fail the wait on a benign line. is_benign_line doesn't work on a prefix: the pip rule is PIP_TIMEOUT_RETRY.fullmatch(line). If a poll lands while WARNING: Retrying (...) after connection broken by 'ReadTimeoutError(...)': /simple/... is half-written, the prefix doesn't match, TimeoutError hits, and wait_for_endpoint_ready aborts on that first hit. Worker stdout redirected to a file is block-buffered and forwarded by srun, so cut-off lines at EOF are common, especially in the high-volume warmup this PR targets.
The tail is rescanned once its newline arrives, so dropping these two lines loses nothing except an error line with no trailing newline from a process that has already exited, and fail_if_proc_died covers that case. If you keep scanning the tail, add a test that splits a pip-retry line across two scan() calls.
Description
wait_for_endpoint_readyread every server log in full at each check, every 30 s. In a disaggregated perf-sanity e2e case, the benchmark rank waits this way on another node than the srun that appends the ctx and gen worker logs on Lustre:MiniMax-M3's gen worker logs about 300 MB in its warmup, so its e2e startup ran up to 1,977 s longer than the same server in gen_only, which scans its log on its own node.
LogScanner(tests/test_common/error_utils.py) keeps each log's scanned offset and line count, so a scan reads only what the log gained since the last one.wait_for_endpoint_readyuses one per wait;check_errorkeeps its full scan.Test Coverage
tests/unittest/others/test_http_utils_fail_fast.pypasses.l0_gb300_multi_nodes_perf_sanityon GB300 (oci-aga), before → after this change, for main's post-merge build 3085, [TRTLLM-17679][feat] KernelBuilder build mode and autotuner tune mode on per-rank worker processes; JIT builds shared within a node by default #22374 and [TRTLLM-17679][feat] MiniMax-M3: build kernels while the checkpoint loads #21628 over it. Gen server startup (worker_submit_to_ready, s), and the same server in gen_only:With this change every e2e gen server starts within 61 s of its gen_only server (before: up to +1,977 s). Sampled during the warmup, the thread of the srun that writes the gen log waited on Lustre locks in 37 of 40 samples before this change, and in none of 40 after it.
PR Checklist
🤖 Generated with Claude Code
Dev Engineer Review
LogScanner): Eachscancall reads only bytes appended since the previous call. It advances the offset only past complete lines.size < offset. If a log is replaced and grows past the old offset between scans, the scanner skips the new content from the start of the file. Note this limit in the docstring or handle it with an inode or identity check.\n, then decoded throughTextIOWrapper. This matches the earlier text-mode behavior for\nendings. A file that uses only\rline endings is not split the same way.check_errorrefactor: Keyword matching moved into_error_lines.check_errorkeeps its full-scan behavior.wait_for_endpoint_ready: It creates one scanner per wait and calls it for each check file. The error-reporting path is unchanged.tests/test_common/. No production code changed.QA Engineer Review
tests/test_common/error_utils.py(modified) andtests/test_common/http_utils.py(modified). Both are test helpers. No test functions, test IDs, or waivers changed in this diff.test-db/orqa/list entries changed.LogScanner. The cases below are not covered by changes in this diff:tests/unittest/others/test_http_utils_fail_fast.py. That file is not in this diff. Its result cannot be confirmed from this diff.Per-File QA Perspective
tests/test_common/error_utils.py: Check thatcheck_errorresults match the old output. Check that an error line split across two scans is reported once, or document the double report. Check that a truncated log restarts from line 1.tests/test_common/http_utils.py: Check that a failing server log still stops the wait and prints the server-log tail. Check that repeated checks report new errors only.