Skip to content

Conversation

yiqingy0
Copy link
Collaborator

@yiqingy0 yiqingy0 commented Aug 14, 2025

Summary by CodeRabbit

  • Chores

    • Downstream L0 tests can now opt to reuse prior build artifacts to speed CI runs.
    • Test runs can skip previously passed tests when a reuse artifact path is provided, reducing redundant execution.
    • Added a utility to extract passed test names and update test lists automatically.
  • Tests

    • One end-to-end test is currently forced to fail, causing a deterministic test failure.

Description

Test Coverage

GitHub Bot Help

/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...

Provide a user friendly way for developers to interact with a Jenkins server.

Run /bot [-h|--help] to print this help message.

See details below for each supported subcommand.

run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental)]

Launch build/test pipelines. All previously running jobs will be killed.

--reuse-test (optional)pipeline-id (OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.

--disable-reuse-test (OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.

--disable-fail-fast (OPTIONAL) : Disable fail fast on build/tests/infra failures.

--skip-test (OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.

--stage-list "A10-PyTorch-1, xxx" (OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: Does NOT update GitHub check status.

--gpu-type "A30, H100_PCIe" (OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.

--test-backend "pytorch, cpp" (OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.

--only-multi-gpu-test (OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.

--disable-multi-gpu-test (OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.

--add-multi-gpu-test (OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.

--post-merge (OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.

--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" (OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".

--detailed-log (OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.

--debug (OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in the stage-list parameter to access the appropriate container environment. Note: Does NOT update GitHub check status.

For guidance on mapping tests to stage names, see docs/source/reference/ci-overview.md
and the scripts/test_to_stage_mapping.py helper.

kill

kill

Kill all running builds associated with pull request.

skip

skip --comment COMMENT

Skip testing for latest commit on pull request. --comment "Reason for skipping build/test" is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

reuse-pipeline

reuse-pipeline

Reuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

Signed-off-by: Yiqing Yan <[email protected]>
Copy link
Contributor

coderabbitai bot commented Aug 14, 2025

📝 Walkthrough

Walkthrough

Passes reuseBuild into downstream L0 launches, adds conditional reuse of prior test results by downloading and pruning passed tests, introduces a CLI Python utility to extract/remove passed tests from JUnit results, and makes an integration test fail immediately.

Changes

Cohort / File(s) Summary
Pipeline fan-out parameterization
jenkins/L0_MergeRequest.groovy
Replaced literal false with reuseBuild when calling launchJob for downstream L0 jobs (x86_64 and SBSA single/multi-GPU) so the downstream job can receive reuseBuild and optionally set reuseArtifactPath.
L0 test reuse flow
jenkins/L0_Test.groovy
Adds REUSE_ARTIFACT_PATH = env.reuseArtifactPath and a new function def reusePassedTests(pipeline, llmSrc, reusedArtifactPath, stageName, testListFile). When REUSE_ARTIFACT_PATH is set, code downloads previous results, extracts passed tests, and removes them from the current test list in both Slurm multi-node and platform run paths; adds logging and error handling; call sites updated to pass llmSrc.
Result reuse utility script
jenkins/scripts/reuse_passed_tests.py
New script with get_passed_tests(input_file, output_file) and remove_passed_tests(input_file, passed_tests_file) plus a small argparse CLI. Parses JUnit XML to list passed tests and filters them from a test list; imports test_rerun.parse_name.
Integration test behavior change
tests/integration/defs/test_e2e.py
test_openai_chat_example now immediately calls pytest.fail("test_openai_chat_example"), causing a deterministic early test failure.

Sequence Diagram(s)

sequenceDiagram
    participant MR as L0_MergeRequest
    participant L0 as L0_Test job
    participant Store as Artifact Storage
    participant Script as reuse_passed_tests.py

    MR->>L0: launchJob(..., reuseBuild)
    alt reuseBuild provided
        L0->>Store: download results-<stage>.tar.gz
        L0->>L0: extract results.xml
        L0->>Script: get_passed_tests(results.xml -> passed_tests.txt)
        L0->>Script: remove_passed_tests(test_list.txt, passed_tests.txt)
        L0->>L0: run tests with pruned test_list
    else reuseBuild not provided
        L0->>L0: run tests with full test_list
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • niukuo
  • chzblych
  • ZhanruiSunCh
  • EmmaQiaoCh

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9f5c575 and a8b8290.

📒 Files selected for processing (2)
  • jenkins/L0_Test.groovy (4 hunks)
  • jenkins/scripts/reuse_passed_tests.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • jenkins/scripts/reuse_passed_tests.py
  • jenkins/L0_Test.groovy
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Pre-commit Check
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

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

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@yiqingy0
Copy link
Collaborator Author

/bot run --stage-list "A10-PyTorch-1"

@tensorrt-cicd
Copy link
Collaborator

PR_Github #15247 [ run ] triggered by Bot

@yiqingy0
Copy link
Collaborator Author

/bot run --stage-list "A10-PyTorch-1"

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 8

🧹 Nitpick comments (2)
jenkins/scripts/delete_passed_tests.py (2)

40-47: Clarify messaging and exit on hard errors to aid callers.

Silent returns make upstream handling ambiguous. Return non-zero exit codes on hard failures; adjust messages to reflect expected file types.

Apply this diff:

-    if not os.path.exists(input_file):
-        print(f"Input file {input_file} does not exist")
-        return
+    if not os.path.exists(input_file):
+        print(f"Input test list file {input_file} does not exist", file=sys.stderr)
+        sys.exit(1)
     if not os.path.exists(passed_tests_file):
-        print(f"Passed tests file {passed_tests_file} does not exist")
-        return
+        print(f"Passed tests file {passed_tests_file} does not exist", file=sys.stderr)
+        sys.exit(1)

72-92: Harden CLI: check args length and fix help text for remove_passed_tests.

  • Accessing sys.argv[1] without length check can crash.
  • remove_passed_tests --input-file is a test list, not an XML; correct the help.

Apply this diff:

 if __name__ == '__main__':
-    if (sys.argv[1] == "get_passed_tests"):
+    if len(sys.argv) < 2:
+        print("Expected subcommand: get_passed_tests | remove_passed_tests", file=sys.stderr)
+        sys.exit(2)
+    if (sys.argv[1] == "get_passed_tests"):
         parser = argparse.ArgumentParser()
         parser.add_argument('--input-file',
                             required=True,
                             help='Input XML file containing test results')
         parser.add_argument('--output-file',
                             required=True,
                             help='Output file to write passed tests')
         args = parser.parse_args(sys.argv[2:])
         get_passed_tests(args.input_file, args.output_file)
     elif (sys.argv[1] == "remove_passed_tests"):
         parser = argparse.ArgumentParser()
         parser.add_argument('--input-file',
                             required=True,
-                            help='Input XML file containing test results')
+                            help='Input test list file (one test name per line)')
         parser.add_argument('--passed-tests-file',
                             required=True,
                             help='File containing passed tests')
         args = parser.parse_args(sys.argv[2:])
         remove_passed_tests(args.input_file, args.passed_tests_file)
+    else:
+        print(f"Unknown subcommand: {sys.argv[1]}", file=sys.stderr)
+        sys.exit(2)
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5cd8c0f and fe9bc47.

📒 Files selected for processing (4)
  • jenkins/L0_MergeRequest.groovy (4 hunks)
  • jenkins/L0_Test.groovy (4 hunks)
  • jenkins/scripts/delete_passed_tests.py (1 hunks)
  • tests/integration/defs/test_e2e.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py

📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)

**/*.py: Python code must target Python 3.8+
Python indentation: 4 spaces, no tabs
Maintain module namespace in imports (from package.subpackage import foo; then use foo.SomeClass())
Python file names use snake_case
Python class names use PascalCase
Python functions/methods and local variables use snake_case; variables starting with a number get k_ prefix (e.g., k_99th_percentile)
Global variables use G_ prefixed UPPER_SNAKE_CASE (e.g., G_MY_GLOBAL)
Constants use UPPER_SNAKE_CASE in Python
Avoid shadowing variables from outer scopes in Python
Initialize all externally visible members of a Python class in init
Prefer docstrings for interfaces used outside a file; comments for local code
Use Google-style docstrings for classes and functions (Sphinx-parsable)
Document attributes/variables inline with short docstrings
Avoid reflection when simple alternatives exist (e.g., prefer explicit parameters over dict(**locals()))
In try/except, catch the narrowest exceptions possible
For duck-typing with try/except, keep try body minimal and put logic in else

Files:

  • tests/integration/defs/test_e2e.py
  • jenkins/scripts/delete_passed_tests.py
**/*.{cpp,cxx,cc,cu,h,hpp,hxx,hh,cuh,py}

📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)

Prepend NVIDIA copyright header (current year) to all source files

Files:

  • tests/integration/defs/test_e2e.py
  • jenkins/scripts/delete_passed_tests.py
🔇 Additional comments (3)
jenkins/L0_MergeRequest.groovy (3)

1042-1042: Verify reuseBuild is a valid build number or handled as a sentinel

Forwarding reuseBuild to launchJob(...) is fine, but confirm upstream only supplies a numeric build ID, null, or a known sentinel (e.g., "latest"). A non-numeric value may produce an invalid reuseArtifactPath.

  • Location to check:

    • jenkins/L0_MergeRequest.groovy — line ~1042
    • Snippet:
      launchJob("L0_Test-x86_64-Single-GPU", reuseBuild, enableFailFast, globalVars, "x86_64", additionalParameters)
      
  • Recommended hardening for launchJob(...):

    • Accept reuseBuild values: null (derive last successful), "latest" (treat as last successful), or a numeric build ID.
    • Validate before constructing paths (e.g., numeric check via regex /^\d+$/ or try Integer.parseInt; or use reuseBuild.isInteger() where appropriate). If invalid, skip reuse and log a warning.
    • Also validate/whitelist inputs from the upstream bot if possible.

I can provide a small patch to implement these guards if you want.


1098-1098: Incorrect — reuseBuild is already validated in launchJob; no extra check needed for the Multi-GPU call

launchJob(...) guards construction of reuseArtifactPath with a truthy check on reuseBuild, so passing reuseBuild into the Multi-GPU invocation is safe.

  • jenkins/L0_MergeRequest.groovy: def launchJob(...) at line 969 — validates reuseBuild before setting parameters['reuseArtifactPath'] (lines ~995–996).
  • jenkins/L0_MergeRequest.groovy: Multi-GPU invocation at line 1098 — launchJob("L0_Test-x86_64-Multi-GPU", reuseBuild, ...)

If you want "default to last successful pipeline" behavior when reuseBuild is omitted, that’s a separate behavior change to implement intentionally.

Likely an incorrect or invalid review comment.


1200-1200: No change needed — SBSA multi‑GPU already has the same reuse/guard logic

Short verification: I inspected jenkins/L0_MergeRequest.groovy — the SBSA test path contains the same gating and error/commit-guard behaviour as the x86 path (it tracks singleGpuTestFailed, checks requireMultiGpuTesting, blocks multi‑GPU when single‑GPU failed except on PostMerge, then calls launchJob with reuseBuild).

Relevant locations:

  • jenkins/L0_MergeRequest.groovy — reuseBuild set from gitlab params (around line ~134)
  • launchJob(...) definition (around line ~969)
  • x86 multi‑GPU gating & launch (around lines ~1098)
  • SBSA single‑GPU gating, requireMultiGpuTesting check and the multi‑GPU launch (launchJob("L0_Test-SBSA-Multi-GPU", ...) at line 1200; gating logic just above)

Action: Ignore the original suggestion to replicate reuse/commit‑guard logic — it’s already present.

Likely an incorrect or invalid review comment.

]

launchJob("L0_Test-SBSA-Single-GPU", false, enableFailFast, globalVars, "SBSA", additionalParameters)
launchJob("L0_Test-SBSA-Single-GPU", reuseBuild, enableFailFast, globalVars, "SBSA", additionalParameters)
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

SBSA single-GPU: ensure reuseBuild correctness and commit guard.

Plumbing is correct. Per PR objective, reuse should be ignored when the Git commit differs. That logic isn’t present here. Consider deriving the reused build’s commit and comparing to env.gitlabCommit before passing reuseArtifactPath.

I can draft a helper to query the reused build’s recorded commit and null out reuse if it differs.


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "---- Show file existence and path ----"
rg --hidden --files --glob '!node_modules' --glob '!dist' "L0_MergeRequest.groovy" || true

echo
echo "---- Print lines 1100-1165 of jenkins/L0_MergeRequest.groovy (if exists) ----"
if [ -f jenkins/L0_MergeRequest.groovy ]; then
  nl -ba -w3 -s': ' jenkins/L0_MergeRequest.groovy | sed -n '1088,1168p'
else
  echo "file not found: jenkins/L0_MergeRequest.groovy"
fi

echo
echo "---- Search for launchJob definition/usage ----"
rg --hidden -n --glob '!node_modules' "launchJob" || true

echo
echo "---- Show functions/places that reference reuseBuild or reuseArtifactPath ----"
rg --hidden -n --glob '!node_modules' "reuseBuild|reuseArtifactPath|gitlabCommit|env.gitlabCommit" || true

echo
echo "---- Show surrounding function where the launch occurs (context for the call site) ----"
# Try to find the method that contains the call near the shown line
if rg -n "L0_Test-SBSA-Single-GPU" jenkins/L0_MergeRequest.groovy >/dev/null 2>&1; then
  line_num=$(rg -n "L0_Test-SBSA-Single-GPU" jenkins/L0_MergeRequest.groovy | awk -F: '{print $2}' | head -n1)
  start=$(( line_num - 60 ))
  end=$(( line_num + 20 ))
  if [ "$start" -lt 1 ]; then start=1; fi
  nl -ba -w3 -s': ' jenkins/L0_MergeRequest.groovy | sed -n "${start},${end}p"
else
  echo "string 'L0_Test-SBSA-Single-GPU' not found in jenkins/L0_MergeRequest.groovy"
fi

Length of output: 641


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "---- List all .groovy files (first 200) ----"
rg --hidden --files -g '*.groovy' | sed -n '1,200p' || true

echo
echo "---- Search for the specific job string ----"
rg -n --hidden --no-ignore-vcs --line-number "L0_Test-SBSA-Single-GPU" || true

echo
echo "---- Search for launchJob usages (calls) ----"
rg -n --hidden --no-ignore-vcs --line-number "launchJob\\(" || true

echo
echo "---- Search for reuse-related identifiers ----"
rg -n --hidden --no-ignore-vcs --line-number "reuseBuild|reuseArtifactPath|env\\.gitlabCommit|gitlabCommit" || true

echo
echo "---- Try to find launchJob definition ----"
rg -n --hidden --no-ignore-vcs --line-number "^\\s*(def|function)\\s+launchJob\\b|launchJob\\s*=\\s*\\{\\s*\\$" || true

Length of output: 8047


🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE1=jenkins/L0_MergeRequest.groovy
FILE2=jenkins/Build.groovy
FILE3=jenkins/L0_Test.groovy

echo "---- jenkins/L0_MergeRequest.groovy (120-140) ----"
sed -n '120,140p' "$FILE1" || true
echo

echo "---- jenkins/L0_MergeRequest.groovy (300-330) ----"
sed -n '300,330p' "$FILE1" || true
echo

echo "---- jenkins/L0_MergeRequest.groovy (960-1010) launchJob definition ----"
sed -n '960,1010p' "$FILE1" || true
echo

echo "---- jenkins/L0_MergeRequest.groovy (1116-1160) surrounding SBSA Single-GPU call ----"
sed -n '1116,1160p' "$FILE1" || true
echo

echo "---- jenkins/Build.groovy (270-420) downloadArtifacts / buildOrCache ----"
sed -n '270,420p' "$FILE2" || true
echo

echo "---- jenkins/L0_Test.groovy (1-48) top definitions ----"
sed -n '1,48p' "$FILE3" || true
echo

echo "---- Search for artifactCommit assignments ----"
rg -n --hidden --no-ignore-vcs "artifactCommit" || true

Length of output: 15155


SBSA single-GPU: enforce commit check before reusing artifacts

launchJob currently sets reuseArtifactPath whenever reuseBuild is truthy — there is no verification that the reused build's recorded commit matches env.gitlabCommit. That allows reusing artifacts from a different commit.

Files to change:

  • jenkins/L0_MergeRequest.groovy
    • String reuseBuild = gitlabParamsFromBot.get('reuse_build', null) (≈ line 134)
    • def launchJob(...) (defined ≈ line 969): replace the unconditional reuseArtifactPath assignment with a validated path only when the reused build's recorded commit equals env.gitlabCommit.
    • Add a helper (e.g. validateReuseBuildCommit or resolveReuseBuild) that queries the reused build's recorded commit (via Artifactory metadata or a small marker file under sw-tensorrt-generic/llm-artifacts/${JOB_NAME}/${reuseBuild}) and returns null when it differs.

Optional/related:

  • jenkins/Build.groovy (downloadArtifacts/buildOrCache, ≈ lines 270–420) currently falls back on rebuild if downloads fail, but does not check commit equality — keep as a safety net but perform the commit validation earlier (in L0_MergeRequest.groovy/launchJob).

Suggested minimal diff (conceptual):

  • Replace in launchJob:
    if (reuseBuild) {
    parameters['reuseArtifactPath'] = "sw-tensorrt-generic/llm-artifacts/${JOB_NAME}/${reuseBuild}"
    }

  • With:
    if (reuseBuild) {
    def validReuse = validateReuseBuildCommit(reuseBuild)
    if (validReuse) {
    parameters['reuseArtifactPath'] = "sw-tensorrt-generic/llm-artifacts/${JOB_NAME}/${validReuse}"
    } else {
    echo "Ignoring reuse_build=${reuseBuild}: recorded commit != ${env.gitlabCommit}"
    }
    }

I can draft the validateReuseBuildCommit helper (using Artifactory REST API or rtDownload to fetch a small commit marker) and a ready-to-drop patch if you want.

🤖 Prompt for AI Agents
In jenkins/L0_MergeRequest.groovy around lines 130–140 and 960–980 (and helper
addition anywhere near other helper defs), ensure reuse_build is not blindly
trusted: change the code that reads String reuseBuild =
gitlabParamsFromBot.get('reuse_build', null) to keep the value but do not set
reuseArtifactPath unconditionally in launchJob; instead, implement and call a
helper validateReuseBuildCommit(reuseBuild) that queries the reused-build
metadata (e.g., Artifactory REST API or download a small commit marker file at
sw-tensorrt-generic/llm-artifacts/${JOB_NAME}/${reuseBuild}) and returns the
reuseBuild string only if its recorded commit equals env.gitlabCommit, otherwise
return null; then in launchJob replace the unconditional
parameters['reuseArtifactPath'] assignment with a conditional that sets
parameters['reuseArtifactPath'] =
"sw-tensorrt-generic/llm-artifacts/${JOB_NAME}/${validReuse}" only when
validateReuseBuildCommit returned a non-null value and echo a message when
ignored; leave Build.groovy fallback as-is.

Comment on lines 1 to 5
import os
import sys
import argparse
import xml.etree.ElementTree as ET
from test_rerun import parse_name
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add mandatory NVIDIA copyright header and docstrings.

Per repo guidelines, prepend the NVIDIA copyright header and add docstrings for public functions.

Apply this diff:

+# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0
+
 import os
 import sys
 import argparse
 import xml.etree.ElementTree as ET
 from test_rerun import parse_name
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import os
import sys
import argparse
import xml.etree.ElementTree as ET
from test_rerun import parse_name
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import argparse
import xml.etree.ElementTree as ET
from test_rerun import parse_name
🤖 Prompt for AI Agents
In jenkins/scripts/delete_passed_tests.py around lines 1 to 5, the file is
missing the mandatory NVIDIA copyright header and module/function docstrings;
prepend the required NVIDIA copyright header at the very top of the file per
repo guidelines, add a concise module-level docstring beneath it describing the
script's purpose, and add/complete docstrings for every public function (include
brief description, parameters and return values) so all public APIs are
documented.

Comment on lines 7 to 33
def get_passed_tests(input_file, output_file):
if not os.path.exists(input_file):
print(f"Input file {input_file} does not exist")
return

# Parse the JUnit XML file and extract passed test names
passed_tests = []
try:
tree = ET.parse(input_file)
root = tree.getroot()
suite = root.find('testsuite')
for testcase in suite.iter('testcase'):
# Check test status
has_failure = testcase.find('failure') is not None
has_error = testcase.find('error') is not None
has_skipped = testcase.find('skipped') is not None
if not has_failure and not has_error and not has_skipped:
# Parse the test name
classname = testcase.attrib.get('classname', '')
name = testcase.attrib.get('name', '')
filename = testcase.attrib.get('file', '')
testName = parse_name(classname, name, filename)
passed_tests.append(testName)
except Exception as e:
print(f"Failed to parse {input_file}: {e}")
return

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Handle both and roots; avoid None deref.

root.find('testsuite') returns None when the root is already a <testsuite>, causing a crash. Support both shapes and guard against missing suites.

Apply this diff:

 def get_passed_tests(input_file, output_file):
@@
-    passed_tests = []
+    passed_tests = []
     try:
         tree = ET.parse(input_file)
         root = tree.getroot()
-        suite = root.find('testsuite')
-        for testcase in suite.iter('testcase'):
+        suites = []
+        if root.tag == 'testsuite':
+            suites = [root]
+        elif root.tag == 'testsuites':
+            suites = list(root.findall('testsuite'))
+        else:
+            suites = list(root.findall('.//testsuite'))
+        for suite in suites:
+            for testcase in suite.iter('testcase'):
                 # Check test status
-            has_failure = testcase.find('failure') is not None
-            has_error = testcase.find('error') is not None
-            has_skipped = testcase.find('skipped') is not None
-            if not has_failure and not has_error and not has_skipped:
-                # Parse the test name
-                classname = testcase.attrib.get('classname', '')
-                name = testcase.attrib.get('name', '')
-                filename = testcase.attrib.get('file', '')
-                testName = parse_name(classname, name, filename)
-                passed_tests.append(testName)
+                has_failure = testcase.find('failure') is not None
+                has_error = testcase.find('error') is not None
+                has_skipped = testcase.find('skipped') is not None
+                if not has_failure and not has_error and not has_skipped:
+                    classname = testcase.attrib.get('classname', '')
+                    name = testcase.attrib.get('name', '')
+                    filename = testcase.attrib.get('file', '')
+                    testName = parse_name(classname, name, filename)
+                    passed_tests.append(testName)
@@
-    # Write passed test names to output file, one per line
+    # Deduplicate and write passed test names to output file, one per line
     with open(output_file, 'w') as f:
-        for test in passed_tests:
+        for test in sorted(set(passed_tests)):
             f.write(test + '\n')
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def get_passed_tests(input_file, output_file):
if not os.path.exists(input_file):
print(f"Input file {input_file} does not exist")
return
# Parse the JUnit XML file and extract passed test names
passed_tests = []
try:
tree = ET.parse(input_file)
root = tree.getroot()
suite = root.find('testsuite')
for testcase in suite.iter('testcase'):
# Check test status
has_failure = testcase.find('failure') is not None
has_error = testcase.find('error') is not None
has_skipped = testcase.find('skipped') is not None
if not has_failure and not has_error and not has_skipped:
# Parse the test name
classname = testcase.attrib.get('classname', '')
name = testcase.attrib.get('name', '')
filename = testcase.attrib.get('file', '')
testName = parse_name(classname, name, filename)
passed_tests.append(testName)
except Exception as e:
print(f"Failed to parse {input_file}: {e}")
return
def get_passed_tests(input_file, output_file):
if not os.path.exists(input_file):
print(f"Input file {input_file} does not exist")
return
# Parse the JUnit XML file and extract passed test names
passed_tests = []
try:
tree = ET.parse(input_file)
root = tree.getroot()
suites = []
if root.tag == 'testsuite':
suites = [root]
elif root.tag == 'testsuites':
suites = list(root.findall('testsuite'))
else:
suites = list(root.findall('.//testsuite'))
for suite in suites:
for testcase in suite.iter('testcase'):
# Check test status
has_failure = testcase.find('failure') is not None
has_error = testcase.find('error') is not None
has_skipped = testcase.find('skipped') is not None
if not has_failure and not has_error and not has_skipped:
classname = testcase.attrib.get('classname', '')
name = testcase.attrib.get('name', '')
filename = testcase.attrib.get('file', '')
testName = parse_name(classname, name, filename)
passed_tests.append(testName)
except Exception as e:
print(f"Failed to parse {input_file}: {e}")
return
# Deduplicate and write passed test names to output file, one per line
with open(output_file, 'w') as f:
for test in sorted(set(passed_tests)):
f.write(test + '\n')
🤖 Prompt for AI Agents
In jenkins/scripts/delete_passed_tests.py around lines 7 to 33, the code assumes
root.find('testsuite') exists which breaks when the XML root is itself a
<testsuite> or when no suites are present; update the parsing to handle both
shapes by: check root.tag and if root.tag == 'testsuite' treat root as the
single suite, else if root.tag == 'testsuites' iterate over
root.findall('testsuite'); ensure you guard against a None or empty suite list
(return or continue) before calling suite.iter('testcase'), and keep the
existing testcase handling unchanged.


@pytest.mark.parametrize("backend", ["pytorch", "trt"])
def test_openai_chat_example(llm_root, llm_venv, backend: str):
pytest.fail("test_openai_chat_example")
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Remove unconditional failure; this breaks the entire param test.

pytest.fail("test_openai_chat_example") makes the test always fail across backends. If this was for debugging, please remove before merge.

Apply this diff:

-    pytest.fail("test_openai_chat_example")
+    # Removed accidental debug fail; enable test execution
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
pytest.fail("test_openai_chat_example")
# Removed accidental debug fail; enable test execution
🤖 Prompt for AI Agents
In tests/integration/defs/test_e2e.py around line 1465 there is an unconditional
pytest.fail("test_openai_chat_example") which forces the entire parametrized
test suite to fail; remove that pytest.fail call (or replace it with an
appropriate assertion or skip if debugging was intended) so the test can run
normally across backends, and if this was temporary debugging add a comment
and/or use pytest.skip with a reason instead of fail.

@tensorrt-cicd
Copy link
Collaborator

PR_Github #15249 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #15247 [ run ] completed with state ABORTED

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🔭 Outside diff range comments (1)
jenkins/scripts/reuse_passed_tests.py (1)

74-95: Replace brittle sys.argv dispatch with argparse subparsers; fix help text mismatch

  • Accessing sys.argv[1] unguarded raises IndexError when invoked without args.
  • Use subparsers for robust UX and built-in help.
  • Update help for remove_passed_tests to reflect it expects a test list file, not XML.

Apply this diff:

-if __name__ == '__main__':
-    if (sys.argv[1] == "get_passed_tests"):
-        parser = argparse.ArgumentParser()
-        parser.add_argument('--input-file',
-                            required=True,
-                            help='Input XML file containing test results')
-        parser.add_argument('--output-file',
-                            required=True,
-                            help='Output file to write passed tests')
-        args = parser.parse_args(sys.argv[2:])
-        get_passed_tests(args.input_file, args.output_file)
-    elif (sys.argv[1] == "remove_passed_tests"):
-        parser = argparse.ArgumentParser()
-        parser.add_argument('--input-file',
-                            required=True,
-                            help='Input XML file containing test results')
-        parser.add_argument('--passed-tests-file',
-                            required=True,
-                            help='File containing passed tests')
-        args = parser.parse_args(sys.argv[2:])
-        remove_passed_tests(args.input_file, args.passed_tests_file)
+if __name__ == '__main__':
+    parser = argparse.ArgumentParser(
+        description='Extract and manipulate passed tests from JUnit XML reports and test lists.'
+    )
+    subparsers = parser.add_subparsers(dest='command', required=True)
+
+    gp = subparsers.add_parser('get_passed_tests', help='Extract passed tests from a JUnit XML report')
+    gp.add_argument('--input-file', required=True, help='Input JUnit XML file containing test results')
+    gp.add_argument('--output-file', required=True, help='Output file to write passed tests (one per line)')
+
+    rp = subparsers.add_parser('remove_passed_tests', help='Remove passed tests from a test list file')
+    rp.add_argument('--input-file', required=True, help='Input file containing tests to run (one per line)')
+    rp.add_argument('--passed-tests-file', required=True, help='File containing passed tests (one per line)')
+
+    args = parser.parse_args()
+    if args.command == 'get_passed_tests':
+        get_passed_tests(args.input_file, args.output_file)
+    elif args.command == 'remove_passed_tests':
+        remove_passed_tests(args.input_file, args.passed_tests_file)
🧹 Nitpick comments (5)
jenkins/scripts/reuse_passed_tests.py (5)

9-13: Add type hints and a docstring to get_passed_tests

Public functions should have clear interfaces and Google-style docstrings.

Apply this diff:

-def get_passed_tests(input_file, output_file):
+def get_passed_tests(input_file: str, output_file: str) -> None:
+    """Extract names of passed tests from a JUnit XML report.
+
+    A test is considered "passed" if it has no <failure>, <error>, or <skipped> child.
+
+    Args:
+        input_file: Path to the JUnit XML file.
+        output_file: Path to the file where passed tests are written (one per line).
+    """
     if not os.path.exists(input_file):
-        print(f"Input file {input_file} does not exist")
+        print(f"Input file {input_file} does not exist", file=sys.stderr)
         return

36-39: Write with explicit UTF-8 encoding

Be explicit about file encoding to avoid locale-dependent behavior on Jenkins workers.

Apply this diff:

-    with open(output_file, 'w') as f:
+    with open(output_file, 'w', encoding='utf-8') as f:
         for test in passed_tests:
             f.write(test + '\n')

10-12: Send error messages to stderr

Error logs should go to stderr to avoid polluting stdout which may be consumed by downstream tooling.

Apply this diff:

-        print(f"Input file {input_file} does not exist")
+        print(f"Input file {input_file} does not exist", file=sys.stderr)
@@
-        print(f"Input file {input_file} does not exist")
+        print(f"Input file {input_file} does not exist", file=sys.stderr)
@@
-        print(f"Passed tests file {passed_tests_file} does not exist")
+        print(f"Passed tests file {passed_tests_file} does not exist", file=sys.stderr)
@@
-        print(f"Failed to delete {input_file}: {e}")
+        print(f"Failed to delete {input_file}: {e}", file=sys.stderr)

Also applies to: 43-49, 67-67


1-95: Confirm exit-code semantics for missing files

Currently, missing files print a message and return 0 (success). This may be intentional in the reuse-artifacts flow (no-op when artifacts are absent). Please confirm the desired behavior so CI logic relying on command success/failure remains correct.

If you prefer non-zero exit codes for specific failure modes, I can wire that in and update the Groovy caller(s) accordingly.


1-95: Add minimal unit tests for core logic

Recommend adding small unit tests for:

  • JUnit root being vs
  • Handling of passed/failure/error/skipped
  • remove_passed_tests filtering, including blank lines and duplicates

I can scaffold pytest-based tests under a tests/ folder and wire into CI if you want.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fe9bc47 and 44132f1.

📒 Files selected for processing (1)
  • jenkins/scripts/reuse_passed_tests.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py

📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)

**/*.py: Python code must target Python 3.8+
Python indentation: 4 spaces, no tabs
Maintain module namespace in imports (from package.subpackage import foo; then use foo.SomeClass())
Python file names use snake_case
Python class names use PascalCase
Python functions/methods and local variables use snake_case; variables starting with a number get k_ prefix (e.g., k_99th_percentile)
Global variables use G_ prefixed UPPER_SNAKE_CASE (e.g., G_MY_GLOBAL)
Constants use UPPER_SNAKE_CASE in Python
Avoid shadowing variables from outer scopes in Python
Initialize all externally visible members of a Python class in init
Prefer docstrings for interfaces used outside a file; comments for local code
Use Google-style docstrings for classes and functions (Sphinx-parsable)
Document attributes/variables inline with short docstrings
Avoid reflection when simple alternatives exist (e.g., prefer explicit parameters over dict(**locals()))
In try/except, catch the narrowest exceptions possible
For duck-typing with try/except, keep try body minimal and put logic in else

Files:

  • jenkins/scripts/reuse_passed_tests.py
**/*.{cpp,cxx,cc,cu,h,hpp,hxx,hh,cuh,py}

📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)

Prepend NVIDIA copyright header (current year) to all source files

Files:

  • jenkins/scripts/reuse_passed_tests.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Pre-commit Check

Comment on lines 1 to 7
import argparse
import os
import sys
import xml.etree.ElementTree as ET

from test_rerun import parse_name

Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Add mandatory NVIDIA copyright header and prefer module-namespace import for parse_name

  • Missing the required NVIDIA copyright header (current year) for Python sources per repo guidelines.
  • Prefer preserving module namespace in imports. Import the module and call test_rerun.parse_name(...).

Apply this diff:

+# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
+#
+# NOTE: Replace this header with the canonical NVIDIA header used in this repo
+# (e.g., the standard Apache-2.0 header). Keeping it minimal here for clarity.
+#
 import argparse
 import os
 import sys
 import xml.etree.ElementTree as ET
 
-from test_rerun import parse_name
+import test_rerun

To help locate the canonical header and confirm the import path for test_rerun, run:


🏁 Script executed:

#!/bin/bash
# Find an example Python file to copy the header from
fd -e py | head -n 1 | xargs head -n 10

# Locate test_rerun and ensure parse_name exists
fd -a 'test_rerun.py'
rg -n "def parse_name" -A 2 | sed -n '1,5p'

Length of output: 621


Add NVIDIA copyright header and switch to module import for parse_name

Verified: test_rerun.py is at jenkins/scripts/test_rerun.py and defines parse_name at line 7.

  • Files to change:
    • jenkins/scripts/reuse_passed_tests.py — add the required NVIDIA header and replace the named import with a module import; update calls to use test_rerun.parse_name(...)
    • jenkins/scripts/test_rerun.py — parse_name definition confirmed (jenkins/scripts/test_rerun.py:7)

Apply this patch:

+# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
+#
+# NOTE: Replace this header with the canonical NVIDIA header used in this repo
+# (e.g., the standard Apache-2.0 header). Keeping it minimal here for clarity.
+#
 import argparse
 import os
 import sys
 import xml.etree.ElementTree as ET
 
-from test_rerun import parse_name
+import test_rerun
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import argparse
import os
import sys
import xml.etree.ElementTree as ET
from test_rerun import parse_name
# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
#
# NOTE: Replace this header with the canonical NVIDIA header used in this repo
# (e.g., the standard Apache-2.0 header). Keeping it minimal here for clarity.
#
import argparse
import os
import sys
import xml.etree.ElementTree as ET
import test_rerun
🤖 Prompt for AI Agents
In jenkins/scripts/reuse_passed_tests.py lines 1-7, add the required NVIDIA
copyright header at the top of the file per project standard, replace the
current named import "from test_rerun import parse_name" with a module import
"import test_rerun", and update all usages of parse_name(...) in this file to
call test_rerun.parse_name(...); keep all other imports and logic unchanged
(note: parse_name is defined in jenkins/scripts/test_rerun.py at line 7).

Comment on lines +32 to +34
except Exception as e:
print(f"Failed to parse {input_file}: {e}")
return
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Catch narrow exception type and log to stderr

Catching broad Exception hides unrelated issues. Limit to XML parse errors and send diagnostics to stderr.

Apply this diff:

-    except Exception as e:
-        print(f"Failed to parse {input_file}: {e}")
+    except ET.ParseError as e:
+        print(f"Failed to parse {input_file}: {e}", file=sys.stderr)
         return
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
except Exception as e:
print(f"Failed to parse {input_file}: {e}")
return
except ET.ParseError as e:
print(f"Failed to parse {input_file}: {e}", file=sys.stderr)
return
🤖 Prompt for AI Agents
In jenkins/scripts/reuse_passed_tests.py around lines 32-34, replace the broad
"except Exception as e" with a narrow XML parse error handler (e.g., except
xml.etree.ElementTree.ParseError as e or except ET.ParseError as e if you import
xml.etree.ElementTree as ET), ensure you import sys and the XML module if not
already, and write the diagnostic to stderr (print(f"Failed to parse
{input_file}: {e}", file=sys.stderr)) before returning.

Comment on lines +42 to +49
def remove_passed_tests(input_file, passed_tests_file):
if not os.path.exists(input_file):
print(f"Input file {input_file} does not exist")
return
if not os.path.exists(passed_tests_file):
print(f"Passed tests file {passed_tests_file} does not exist")
return

Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

remove_passed_tests: input semantics, performance, and I/O safety

  • The help text says “Input XML file containing test results” but this function treats it as a plain list of tests. Fix the mismatch.
  • Use a set for O(1) lookups.
  • No need to delete the file before rewriting; opening with 'w' truncates atomically enough for this use.
  • Add type hints, docstring, and UTF-8 encoding. Also skip blank lines.

Apply this diff:

-def remove_passed_tests(input_file, passed_tests_file):
+def remove_passed_tests(input_file: str, passed_tests_file: str) -> None:
+    """Remove tests that already passed from a newline-delimited test list file.
+
+    Args:
+        input_file: Path to a file containing tests to run (one per line).
+        passed_tests_file: Path to a file containing already-passed tests (one per line).
+    """
     if not os.path.exists(input_file):
-        print(f"Input file {input_file} does not exist")
+        print(f"Input file {input_file} does not exist", file=sys.stderr)
         return
     if not os.path.exists(passed_tests_file):
-        print(f"Passed tests file {passed_tests_file} does not exist")
+        print(f"Passed tests file {passed_tests_file} does not exist", file=sys.stderr)
         return
 
-    passed_tests = []
-    # Read passed tests from file
-    with open(passed_tests_file, 'r') as f:
-        for line in f:
-            passed_tests.append(line.strip())
+    # Read passed tests from file
+    with open(passed_tests_file, 'r', encoding='utf-8') as f:
+        passed_tests = {line.strip() for line in f if line.strip()}
 
-    tests_to_keep = []
-    # Remove passed tests from input file
-    with open(input_file, 'r') as f:
-        for line in f:
-            if line.strip() not in passed_tests:
-                tests_to_keep.append(line.strip())
+    # Remove passed tests from input file
+    with open(input_file, 'r', encoding='utf-8') as f:
+        tests_to_keep = [line.strip()
+                         for line in f
+                         if line.strip() and line.strip() not in passed_tests]
 
-    # Delete input file
-    try:
-        os.remove(input_file)
-    except Exception as e:
-        print(f"Failed to delete {input_file}: {e}")
     # Write tests to keep to input file
-    with open(input_file, 'w') as f:
+    with open(input_file, 'w', encoding='utf-8') as f:
         for test in tests_to_keep:
             f.write(test + '\n')

Also applies to: 50-71

@yiqingy0
Copy link
Collaborator Author

/bot run --stage-list "A10-PyTorch-1"

@tensorrt-cicd
Copy link
Collaborator

PR_Github #15252 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #15249 [ run ] completed with state ABORTED

Signed-off-by: Yiqing Yan <[email protected]>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (3)
jenkins/L0_Test.groovy (3)

354-357: Pass required context into reusePassedTests (pipeline, llmSrc) to avoid runtime failures.

The current implementation of reusePassedTests references pipeline and llmSrc internally but they aren’t in scope. Pass both explicitly from here. Also aligns with the corrected function signature below.

-                // Reuse passed tests
-                if (REUSE_ARTIFACT_PATH) {
-                    reusePassedTests(REUSE_ARTIFACT_PATH, stageName, testListPath)
-                }
+                // Reuse passed tests
+                if (REUSE_ARTIFACT_PATH) {
+                    reusePassedTests(this, llmSrcLocal, REUSE_ARTIFACT_PATH, stageName, testListPath)
+                }

1452-1456: Pass context to reusePassedTests here as well (pipeline and llmSrc).

Mirror the fix from the multinode path so both call sites are consistent and functional.

-        // Reuse passed tests
-        if (REUSE_ARTIFACT_PATH) {
-            reusePassedTests(REUSE_ARTIFACT_PATH, stageName, testDBList)
-        }
+        // Reuse passed tests
+        if (REUSE_ARTIFACT_PATH) {
+            reusePassedTests(this, llmSrc, REUSE_ARTIFACT_PATH, stageName, testDBList)
+        }

1072-1105: Fix undefined vars, quoting, logging, backup path, and wrong helper-script name in reusePassedTests

Verified:

  • jenkins/scripts/reuse_passed_tests.py exists and defines get_passed_tests (line 9) and remove_passed_tests (line 42).
  • jenkins/L0_Test.groovy currently references delete_passed_tests.py (matches at lines 1082 and 1093) and uses undefined variables pipeline and llmSrc.

Actionable changes (apply the refactor below; it switches to reuse_passed_tests.py and fixes signature, quoting, logging, and backup):

  • Files to update:
    • jenkins/L0_Test.groovy (function reusePassedTests, ~lines 1072–1105; references at 1082 & 1093)
    • Ensure calls point to jenkins/scripts/reuse_passed_tests.py

Proposed diff:

-def reusePassedTests(reusedArtifactPath, stageName, testListFile) {
-    def reusedPath = "${WORKSPACE}/reused"
-    sh "mkdir -p ${reusedPath}"
-    def resultsFileName = "results-${stageName}"
-    def passedTestsFile = "${reusedPath}/${stageName}/passed_tests.txt"
-    try {
-        trtllm_utils.llmExecStepWithRetry(pipeline, script: "cd ${reusedPath} && wget -nv https://urm.nvidia.com/artifactory/${reusedArtifactPath}/test-results/${resultsFileName}.tar.gz")
-        sh "cd ${reusedPath} && tar -zxf ${resultsFileName}.tar.gz"
-        // Get passed tests
-        sh """
-            python3 ${llmSrc}/jenkins/scripts/delete_passed_tests.py \
-            get_passed_tests \
-            --input-file=${reusedPath}/${stageName}/results.xml \
-            --output-file=${passedTestsFile}
-        """
-        sh "The passed tests are: $(cat ${passedTestsFile})"
-
-        // Copy the original test file to a new file
-        sh "cp ${testListFile} original_${testListFile}"
-        // Remove passed tests from original test file
-        sh """
-            python3 ${llmSrc}/jenkins/scripts/delete_passed_tests.py \
-            remove_passed_tests \
-            --input-file=${testListFile} \
-            --passed-tests-file=${passedTestsFile}
-        """
-        sh "The test list after removing passed tests is: $(cat ${testListFile})"
-    } catch (InterruptedException e) {
-        throw e
-    } catch (Exception e) {
-        echo "Failed to get passed tests: ${e.message}"
-    }
-}
+def reusePassedTests(pipeline, llmSrc, reusedArtifactPath, stageName, testListFile) {
+    def reusedPath = "${WORKSPACE}/reused"
+    sh "mkdir -p '${reusedPath}'"
+    def resultsFileName = "results-${stageName}"
+    def passedTestsFile = "${reusedPath}/${stageName}/passed_tests.txt"
+    try {
+        def resultsUrl = reusedArtifactPath?.startsWith("http") ?
+            "${reusedArtifactPath}/test-results/${resultsFileName}.tar.gz" :
+            "https://urm.nvidia.com/artifactory/${reusedArtifactPath}/test-results/${resultsFileName}.tar.gz"
+        trtllm_utils.llmExecStepWithRetry(pipeline, script: "cd '${reusedPath}' && wget -nv '${resultsUrl}'")
+        sh "cd '${reusedPath}' && tar -zxf '${resultsFileName}.tar.gz'"
+        // Get passed tests
+        sh """
+            python3 '${llmSrc}/jenkins/scripts/reuse_passed_tests.py' \
+            get_passed_tests \
+            --input-file='${reusedPath}/${stageName}/results.xml' \
+            --output-file='${passedTestsFile}'
+        """
+        sh "echo \"Passed tests count: \$(wc -l < '${passedTestsFile}' || echo 0)\""
+
+        // Backup the original test file alongside it
+        sh "cp '${testListFile}' '${testListFile}.orig'"
+        // Remove passed tests from the original test file in-place
+        sh """
+            python3 '${llmSrc}/jenkins/scripts/reuse_passed_tests.py' \
+            remove_passed_tests \
+            --input-file='${testListFile}' \
+            --passed-tests-file='${passedTestsFile}'
+        """
+        sh "echo \"Remaining tests count: \$(wc -l < '${testListFile}' || echo 0)\""
+    } catch (InterruptedException e) {
+        throw e
+    } catch (Exception e) {
+        echo "Failed to reuse passed tests: ${e.message}"
+    }
+}

Notes:

  • Verified helper script is reuse_passed_tests.py (CLI functions get_passed_tests/remove_passed_tests exist). Update the Groovy calls to that script (replaces delete_passed_tests.py).
  • Signature change required: accept pipeline and llmSrc as parameters.
  • Quoting and echo usage prevent shell injection and broken outputs; backup now uses .orig suffix next to original file.
🧹 Nitpick comments (1)
jenkins/L0_Test.groovy (1)

28-29: Initialize REUSE_ARTIFACT_PATH defensively (trim to avoid false positives).

Minor: trim any accidental whitespace so the boolean checks behave predictably.

-REUSE_ARTIFACT_PATH = env.reuseArtifactPath
+REUSE_ARTIFACT_PATH = env.reuseArtifactPath?.trim()
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 44132f1 and 9f5c575.

📒 Files selected for processing (1)
  • jenkins/L0_Test.groovy (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Pre-commit Check

@yiqingy0 yiqingy0 force-pushed the reuse_passed_tests branch from 9f5c575 to 13f9ec8 Compare August 14, 2025 07:32
@yiqingy0
Copy link
Collaborator Author

/bot run --stage-list "A10-PyTorch-1"

1 similar comment
@yiqingy0
Copy link
Collaborator Author

/bot run --stage-list "A10-PyTorch-1"

@tensorrt-cicd
Copy link
Collaborator

PR_Github #15252 [ run ] completed with state FAILURE
/LLM/main/L0_MergeRequest_PR pipeline #11516 (Partly Tested) completed with status: 'FAILURE'

@tensorrt-cicd
Copy link
Collaborator

PR_Github #15255 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #15261 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #15255 [ run ] completed with state ABORTED

Signed-off-by: Yiqing Yan <[email protected]>
@yiqingy0
Copy link
Collaborator Author

/bot run --stage-list "A10-PyTorch-1"

@tensorrt-cicd
Copy link
Collaborator

PR_Github #15264 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #15261 [ run ] completed with state ABORTED

@yiqingy0
Copy link
Collaborator Author

/bot run --stage-list "A10-PyTorch-1"

@tensorrt-cicd
Copy link
Collaborator

PR_Github #15268 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #15268 [ run ] completed with state SUCCESS
/LLM/main/L0_MergeRequest_PR pipeline #11527 (Partly Tested) completed with status: 'FAILURE'

@yiqingy0
Copy link
Collaborator Author

/bot run --stage-list "A10-PyTorch-1"

@tensorrt-cicd
Copy link
Collaborator

PR_Github #15287 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #15287 [ run ] completed with state SUCCESS
/LLM/main/L0_MergeRequest_PR pipeline #11540 (Partly Tested) completed with status: 'FAILURE'

@yiqingy0
Copy link
Collaborator Author

/bot run --stage-list "A10-TensorRT-1,A10-PyTorch-1"

@tensorrt-cicd
Copy link
Collaborator

PR_Github #15403 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #15403 [ run ] completed with state SUCCESS
/LLM/main/L0_MergeRequest_PR pipeline #11610 (Partly Tested) completed with status: 'FAILURE'

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.

2 participants