Skip to content

[None][infra] Stop CBTS coverage writes from failing the stage results tar - #17304

Merged
crazydemo merged 1 commit into
NVIDIA:mainfrom
crazydemo:cbts-fix-results-tar-race
Aug 6, 2026
Merged

[None][infra] Stop CBTS coverage writes from failing the stage results tar#17304
crazydemo merged 1 commit into
NVIDIA:mainfrom
crazydemo:cbts-fix-results-tar-race

Conversation

@crazydemo

@crazydemo crazydemo commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Added CBTS_STOP_FILE handling to stop coverage writes before result collection.
  • Added freezeCbtsCoverage(String stageDir) to stabilize coverage output before packaging.
  • Updated sitecustomize.py to stop periodic and final coverage writes when the sentinel exists.
  • Updated CBTS coverage documentation.

Dev Engineer Review

  • The change uses a filesystem sentinel to coordinate coverage shutdown across processes.
  • Coverage is frozen before archive and final-result packaging.
  • The implementation removes stale sentinels before Kubernetes execution.
  • Remote CBTS archives are created after the freeze delay and removed when empty.
  • No test files were changed.
  • Review should verify sentinel cleanup on all failure paths and confirm that the output-stabilization wait does not introduce excessive stage delays.

QA Engineer Review

No test changes.

Description

Test Coverage

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.

  • PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (see test instructions)

  • If PR introduces API changes, an appropriate PR label is added - either api-compatible or api-breaking. For api-breaking, include BREAKING in the PR title.

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • Update tava architecture diagram if there is a significant design change in PR.

  • The reviewers assigned automatically/manually are appropriate for the PR.

  • Please check this after reviewing the above items as appropriate for this PR.

GitHub Bot Help

To see a list of available CI bot commands, please comment /bot help.

@crazydemo
crazydemo marked this pull request as ready for review August 5, 2026 09:20
@crazydemo
crazydemo requested a review from a team as a code owner August 5, 2026 09:20
@crazydemo
crazydemo requested review from niukuo and yiqingy0 August 5, 2026 09:20
@crazydemo

Copy link
Copy Markdown
Collaborator Author

/bot run --stage-list "DGX_H100-PyTorch-1, DGX_H100-PyTorch-2, DGX_H100-PyTorch-3, DGX_H100-PyTorch-4, DGX_H100-PyTorch-5, DGX_H100-PyTorch-6"

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #64009 [ run ] triggered by Bot. Commit: 3d7b717 Link to invocation

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 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.

Inline comments:
In `@jenkins/L0_MergeRequest.groovy`:
- Around line 349-350: Remove the temporary CBTS coverage enablement from the
merge-request pipeline by deleting the `testFilter[(CBTS_COVERAGE)] =
ENABLE_CBTS_COVERAGE` assignment and its debug-only comment. Preserve the
existing post-merge coverage gate behavior elsewhere in the pipeline.

In `@jenkins/L0_Test.groovy`:
- Around line 377-379: Update the archive-retention check in the command
constructing cbtsArchive to validate its members with tar -tzf, retaining the
archive only when it contains a .cbtscov.*.sqlite entry; otherwise remove it.
Replace the current size-only [ -s '${cbtsArchive}' ] check while preserving the
existing archive creation flow.

In `@jenkins/scripts/cbts/coverage_utils/README.md`:
- Line 45: Add the standard NVIDIA copyright header to the modified README,
using 2026 as the latest copyright year. Preserve the existing documentation
content and formatting after the header.

In `@jenkins/scripts/cbts/coverage_utils/sitecustomize.py`:
- Around line 114-119: Implement a shared inter-process writer-drain protocol
around _frozen() and _tracker.save() in
jenkins/scripts/cbts/coverage_utils/sitecustomize.py:114-119 so new saves are
suppressed and writers already admitted are tracked and drained before
collection. Document the suppression and active-writer drain in
jenkins/scripts/cbts/coverage_utils/README.md:45. Update
jenkins/L0_Test.groovy:223-236 to use the shared drain protocol instead of the
single empty-glob check and ignored sentinel failures, and update
jenkins/L0_Test.groovy:372-379 to use the same drain for SLURM collection
instead of the fixed two-second sleep.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: c2d1a52d-ba9a-43c4-9b81-012d0d7ca296

📥 Commits

Reviewing files that changed from the base of the PR and between 9564b3b and 3d7b717.

📒 Files selected for processing (4)
  • jenkins/L0_MergeRequest.groovy
  • jenkins/L0_Test.groovy
  • jenkins/scripts/cbts/coverage_utils/README.md
  • jenkins/scripts/cbts/coverage_utils/sitecustomize.py

Comment thread jenkins/L0_MergeRequest.groovy Outdated
Comment thread jenkins/L0_Test.groovy Outdated
Comment thread jenkins/scripts/cbts/coverage_utils/README.md Outdated
Comment thread jenkins/scripts/cbts/coverage_utils/sitecustomize.py Outdated
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #64009 [ run ] completed with state SUCCESS. Commit: 3d7b717
/LLM/main/L0_MergeRequest_PR pipeline #51941 (Partly Tested) completed with status: 'SUCCESS'
Pipeline passed with automatic retried tests. Check the rerun report for details.

CI Report

Link to invocation

@crazydemo
crazydemo force-pushed the cbts-fix-results-tar-race branch 2 times, most recently from b861948 to fc6800c Compare August 5, 2026 12:44
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 3a76dae8-c85f-45c6-b533-b7f503f35fb7

📥 Commits

Reviewing files that changed from the base of the PR and between 63eb095 and df443f8.

📒 Files selected for processing (3)
  • jenkins/L0_Test.groovy
  • jenkins/scripts/cbts/coverage_utils/README.md
  • jenkins/scripts/cbts/coverage_utils/sitecustomize.py
🚧 Files skipped from review as they are similar to previous changes (3)
  • jenkins/scripts/cbts/coverage_utils/README.md
  • jenkins/scripts/cbts/coverage_utils/sitecustomize.py
  • jenkins/L0_Test.groovy

Walkthrough

CBTS coverage now uses a stop-file sentinel. Jenkins passes the sentinel path to test processes, freezes coverage before packaging, waits for output stability, and removes stale or empty artifacts.

Changes

CBTS coverage lifecycle

Layer / File(s) Summary
Coverage stop-file protocol
jenkins/scripts/cbts/coverage_utils/sitecustomize.py, jenkins/scripts/cbts/coverage_utils/README.md
Coverage persistence checks CBTS_STOP_FILE, skips writes while frozen, stops the periodic-save loop, and documents the stop-file behavior.
Jenkins coverage collection
jenkins/L0_Test.groovy
Jenkins defines and propagates the stop-file name, removes stale sentinels, freezes coverage before packaging, waits for output stability, delays remote archiving, and removes empty archives.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant JenkinsPipeline
  participant PytestProcess
  participant CoverageUtility
  participant ResultArchive
  JenkinsPipeline->>PytestProcess: provide CBTS_STOP_FILE
  PytestProcess->>CoverageUtility: periodic coverage save
  JenkinsPipeline->>JenkinsPipeline: create stop sentinel
  CoverageUtility->>CoverageUtility: stop coverage writes
  JenkinsPipeline->>ResultArchive: package stabilized coverage output
Loading

Suggested reviewers: niukuo

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description retains the template and checklist but does not explain the issue, solution, or test coverage. Add a concise issue and solution summary, list relevant tests or CI jobs, and complete the checklist based on the changes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title follows the required format and clearly describes the CBTS coverage change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (3)
jenkins/scripts/cbts/coverage_utils/sitecustomize.py (1)

114-119: ⚠️ Potential issue | 🟠 Major

Creating CBTS_STOP_FILE suppresses saves that have not yet passed _frozen(), but it does not drain writers that already passed the check. The collectors can therefore archive a .cbtscov file while it is still being written.

  • jenkins/scripts/cbts/coverage_utils/sitecustomize.py#L114-L119: Add the shared inter-process lock or writer-registration protocol.
  • jenkins/scripts/cbts/coverage_utils/sitecustomize.py#L141-L142: Run _save_active() under that protocol.
  • jenkins/scripts/cbts/coverage_utils/sitecustomize.py#L151-L152: Run _final_save() under that protocol.
  • jenkins/scripts/cbts/coverage_utils/sitecustomize.py#L234-L236: Register and drain periodic writers before stopping them.
  • jenkins/scripts/cbts/coverage_utils/README.md#L45-L45: Document the active-writer drain.
  • jenkins/L0_Test.groovy#L223-L236: Require successful sentinel creation and a completed local drain.
  • jenkins/L0_Test.groovy#L2912-L2914: Abort or skip the result archive when the freeze does not complete.
  • jenkins/L0_Test.groovy#L372-L379: Replace the fixed remote delay with the same writer-drain protocol.
🤖 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 `@jenkins/scripts/cbts/coverage_utils/sitecustomize.py` around lines 114 - 119,
Add a shared inter-process lock or writer-registration/drain protocol around
_frozen in sitecustomize.py#L114-L119; execute _save_active and _final_save
under it at lines 141-142 and 151-152, and register and drain periodic writers
before stopping them at lines 234-236. Document the active-writer drain in
jenkins/scripts/cbts/coverage_utils/README.md#L45. In
jenkins/L0_Test.groovy#L223-L236 require successful sentinel creation and local
drain completion, abort or skip archiving at lines 2912-2914 when freezing
fails, and replace the fixed remote delay at lines 372-379 with the same
writer-drain protocol.
jenkins/scripts/cbts/coverage_utils/README.md (1)

45-45: ⚠️ Potential issue | 🟡 Minor

Add the NVIDIA copyright header.

This modified README has no NVIDIA copyright header. Add the repository-standard header and use 2026 as the latest meaningful modification year.

As per coding guidelines, **/* requires the NVIDIA copyright header on modified files and the latest meaningful modification year.

🤖 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 `@jenkins/scripts/cbts/coverage_utils/README.md` at line 45, Add the
repository-standard NVIDIA copyright header at the beginning of README.md, using
2026 as the latest meaningful modification year. Preserve the existing README
content and formatting after the header.

Source: Coding guidelines

jenkins/L0_MergeRequest.groovy (1)

349-350: ⚠️ Potential issue | 🟠 Major

Remove the temporary merge-request coverage override before merge.

ENABLE_CBTS_COVERAGE is true, and this assignment does not check env.JOB_NAME. It propagates cbts_coverage=true to merge-request jobs, which starts periodic SQLite writers and archive work in pre-merge stages. Restore the official post-merge gate before merging.

The PR objective identifies this assignment as temporary debug enablement intended to be reverted before merge.

🤖 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 `@jenkins/L0_MergeRequest.groovy` around lines 349 - 350, Remove the temporary
testFilter[(CBTS_COVERAGE)] = ENABLE_CBTS_COVERAGE override and its debug
comment from the merge-request pipeline configuration. Restore the official
post-merge JOB_NAME-gated coverage behavior, leaving CBTS_COVERAGE enabled only
for the intended post-merge jobs.
🤖 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.

Duplicate comments:
In `@jenkins/L0_MergeRequest.groovy`:
- Around line 349-350: Remove the temporary testFilter[(CBTS_COVERAGE)] =
ENABLE_CBTS_COVERAGE override and its debug comment from the merge-request
pipeline configuration. Restore the official post-merge JOB_NAME-gated coverage
behavior, leaving CBTS_COVERAGE enabled only for the intended post-merge jobs.

In `@jenkins/scripts/cbts/coverage_utils/README.md`:
- Line 45: Add the repository-standard NVIDIA copyright header at the beginning
of README.md, using 2026 as the latest meaningful modification year. Preserve
the existing README content and formatting after the header.

In `@jenkins/scripts/cbts/coverage_utils/sitecustomize.py`:
- Around line 114-119: Add a shared inter-process lock or
writer-registration/drain protocol around _frozen in sitecustomize.py#L114-L119;
execute _save_active and _final_save under it at lines 141-142 and 151-152, and
register and drain periodic writers before stopping them at lines 234-236.
Document the active-writer drain in
jenkins/scripts/cbts/coverage_utils/README.md#L45. In
jenkins/L0_Test.groovy#L223-L236 require successful sentinel creation and local
drain completion, abort or skip archiving at lines 2912-2914 when freezing
fails, and replace the fixed remote delay at lines 372-379 with the same
writer-drain protocol.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: bb5023c1-0be0-468c-b0b4-1377703fa8d7

📥 Commits

Reviewing files that changed from the base of the PR and between a6aeaff and b861948.

📒 Files selected for processing (4)
  • jenkins/L0_MergeRequest.groovy
  • jenkins/L0_Test.groovy
  • jenkins/scripts/cbts/coverage_utils/README.md
  • jenkins/scripts/cbts/coverage_utils/sitecustomize.py

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

Every instrumented process saves its .cbtscov sqlite every 5 seconds into
the stage output directory, which is also what "tar -czvf results-<stage>"
archives. A process that outlives pytest keeps creating files there while
the tar runs, so GNU tar reports "file changed as we read it" and exits 1,
failing the whole stage.

Add a CBTS_STOP_FILE sentinel that sitecustomize.py checks before every
periodic and final save; result collection creates it before archiving and
waits for in-flight writes to land, so the directory is stable by the time
the tar starts. Saves are full snapshots, so skipping the post-freeze save
loses no touches. The sentinel is cleared at stage start so a reused
workspace cannot suppress a later build's coverage.

On the SLURM side the per-stage coverage archive is now kept when tar warns,
instead of deleting a complete archive.

Signed-off-by: Ivy Zhang <25222398+crazydemo@users.noreply.github.com>
@crazydemo
crazydemo force-pushed the cbts-fix-results-tar-race branch from fc6800c to fe417be Compare August 5, 2026 12:54
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@crazydemo

Copy link
Copy Markdown
Collaborator Author

/bot run --stage-list "DGX_H100-PyTorch-1, DGX_H100-PyTorch-2, DGX_H100-PyTorch-3, DGX_H100-PyTorch-4, DGX_H100-PyTorch-5, DGX_H100-PyTorch-6"

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #64052 [ run ] triggered by Bot. Commit: fe417be Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #64052 [ run ] completed with state SUCCESS. Commit: fe417be
/LLM/main/L0_MergeRequest_PR pipeline #51982 (Partly Tested) completed with status: 'SUCCESS'
Pipeline passed with automatic retried tests. Check the rerun report for details.

CI Report

Link to invocation

@crazydemo
crazydemo force-pushed the cbts-fix-results-tar-race branch from fe417be to df443f8 Compare August 6, 2026 02:25
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@crazydemo
crazydemo enabled auto-merge (squash) August 6, 2026 02:26
@crazydemo

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #64176 [ run ] triggered by Bot. Commit: df443f8 Link to invocation

Comment thread jenkins/L0_Test.groovy
@crazydemo
crazydemo disabled auto-merge August 6, 2026 03:06
@crazydemo
crazydemo enabled auto-merge (squash) August 6, 2026 03:09
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #64176 [ run ] completed with state FAILURE. Commit: df443f8
/LLM/main/L0_MergeRequest_PR pipeline #52092 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@crazydemo

Copy link
Copy Markdown
Collaborator Author

/bot skip --comment "the failure is not related to this pr"

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #64247 [ skip ] triggered by Bot. Commit: df443f8 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #64247 [ skip ] completed with state SUCCESS. Commit: df443f8
Skipping testing for commit df443f8

Link to invocation

@crazydemo
crazydemo merged commit 182c540 into NVIDIA:main Aug 6, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants