Fix job log tail truncation#4889
Conversation
Greptile SummaryThis PR changes job log truncation to keep the newest log content.
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (1): Last reviewed commit: "Merge branch 'main' into codex/fix-job-l..." | Re-trigger Greptile |
There was a problem hiding this comment.
Pull request overview
This pull request updates job log truncation on both the CLI and server to retain the newest log content (tail) rather than discarding the end, improving the likelihood that final stack traces and error lines are preserved.
Changes:
- CLI: change byte-based truncation to keep the last
--max-bytesbytes (and add a tail+bytes regression test). - Server: read and return the tail of live and stored logs up to the server cap, and update truncation messaging accordingly.
- Tests: add coverage for tail-preserving truncation across live logs, stored workspace logs, and oversized single-line logs.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
nvflare/tool/job/job_cli.py |
Keep the last max_bytes bytes when bounding CLI job logs. |
nvflare/private/fed/server/job_cmds.py |
Read/decode and cap log output from the end (tail) for live and stored logs. |
tests/unit_test/tool/job/job_logs_test.py |
Add CLI regression coverage to ensure final error lines are preserved under tail+bytes bounds. |
tests/unit_test/private/fed/server/job_cmds_test.py |
Add server-side regression tests for tail-preserving truncation (live, stored, client, oversized line). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| truncated = len(raw_data) > self.MAX_RETURNED_JOB_LOG_BYTES | ||
| if truncated: | ||
| raw_data = raw_data[: self.MAX_RETURNED_JOB_LOG_BYTES] | ||
| raw_data = raw_data[-self.MAX_RETURNED_JOB_LOG_BYTES :] |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4889 +/- ##
==========================================
+ Coverage 60.76% 60.77% +0.01%
==========================================
Files 977 977
Lines 93206 93203 -3
==========================================
+ Hits 56633 56646 +13
+ Misses 36573 36557 -16
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Fixes job log truncation to preserve the newest content and final error lines.
Description
Updates CLI and server-side log bounding to discard content from the beginning rather than the end, ensuring --tail, --max-bytes, and the server’s 5 MiB cap retain final stack traces and errors. Adds regression coverage for live, stored, client, and oversized single-line logs.
Types of changes
./runtest.sh.