Skip to content

Conversation

pcastonguay
Copy link
Collaborator

@pcastonguay pcastonguay commented Sep 25, 2025

Summary by CodeRabbit

  • Tests
    • Improved test reliability by waiting for service ports to become ready instead of using fixed delays, reducing flakiness and intermittent failures.
    • Ensures client setup occurs only after dependent services are reachable, minimizing timeouts and false negatives.
    • Speeds up test execution when services start quickly, while still handling slower startups gracefully.
    • Enhances CI stability and consistency with more deterministic test behavior.

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)

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • 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

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

Copy link
Contributor

coderabbitai bot commented Sep 25, 2025

📝 Walkthrough

Walkthrough

Replaces a fixed sleep-based etcd startup wait with a port readiness check. Introduces wait_for_port(host, port, timeout) using socket polling, integrates it into setUp prior to client creation, removes time.sleep(5), and adds the necessary socket import in the test module.

Changes

Cohort / File(s) Summary
Test setup readiness change
tests/unittest/disaggregated/test_remoteDictionary.py
Added wait_for_port(host, port, timeout=15) using socket polling; imported socket; removed fixed time.sleep(5) in start_etcd_server; updated setUp to call wait_for_port before creating etcd client.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Tester
  participant TestCase
  participant EtcdProc as etcd Process
  participant Port as Port (host:port)
  participant Client as etcd Client

  Note over TestCase: New flow
  Tester->>TestCase: setUp()
  TestCase->>EtcdProc: start_etcd_server()
  EtcdProc-->>TestCase: process started
  TestCase->>Port: wait_for_port(host, port, timeout)
  alt Port opens before timeout
    Port-->>TestCase: ready
    TestCase->>Client: create client()
    Client-->>TestCase: connected
  else Timeout
    Port-->>TestCase: not ready
    TestCase-->>Tester: RuntimeError
  end
Loading
sequenceDiagram
  autonumber
  actor Tester
  participant TestCase
  participant EtcdProc as etcd Process
  participant Sleep as Fixed Delay
  participant Client as etcd Client

  Note over TestCase: Previous flow
  Tester->>TestCase: setUp()
  TestCase->>EtcdProc: start_etcd_server()
  EtcdProc-->>TestCase: process started
  TestCase->>Sleep: time.sleep(5)
  Sleep-->>TestCase: delay done
  TestCase->>Client: create client()
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description Check ⚠️ Warning The PR description is currently just the unmodified template and lacks any filled‐in sections, so it provides no title in the required “[ticket][type] Summary” format, no explanation of the issue or solution, and no Test Coverage details. The checklist items remain unchecked except for a single note, offering reviewers no context to understand or validate the changes. Without these essential details, the pull request cannot be properly assessed. Please update the PR description by adding a title that follows the “[JIRA ticket/NVBugs ID/GitHub issue/None][type] Summary” template, complete the Description section with a brief explanation of the problem and your solution, list relevant tests under the Test Coverage heading, and review and check off each item in the PR Checklist to confirm compliance with repository guidelines.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly summarizes the primary change of adding a connection check to the etcd server in the unit test by using the wait_for_port helper, matching the changeset’s intent without extraneous details.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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

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

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: 1

🧹 Nitpick comments (4)
tests/unittest/disaggregated/test_remoteDictionary.py (4)

13-21: Make the wait helper more specific and linter-friendly (TimeoutError, narrower except).
Good replacement for fixed sleep with a readiness probe. Prefer raising TimeoutError and catching more specific exceptions; also shortens the failure message as suggested by lint (TRY003).

Apply this diff:

-    while time.time() - start < timeout:
+    while time.time() - start < timeout:
         try:
             with socket.create_connection((host, port), timeout=1):
                 return True
-        except OSError:
+        except (ConnectionRefusedError, socket.timeout):
             time.sleep(0.5)
-    raise RuntimeError(f"Timeout waiting for {host}:{port}")
+    raise TimeoutError(f"Timed out waiting for {host}:{port}")

Optionally add a short Google-style docstring and type hints for clarity. Based on coding guidelines and static analysis hints.


10-10: Maintain module namespace for imports.
Prefer importing the module and referencing the class via the module to keep the namespace clear.

Apply this diff:

-from tensorrt_llm.serve.metadata_server import EtcdDictionary
+from tensorrt_llm.serve import metadata_server
@@
-        self.etcd_dict = EtcdDictionary(host=self.host, port=self.port)
+        self.etcd_dict = metadata_server.EtcdDictionary(host=self.host, port=self.port)

As per coding guidelines.

Also applies to: 65-65


29-33: Avoid PIPEs you don't read to prevent child blocking.
Using PIPE for stdout/stderr without consuming can deadlock if buffers fill. Route to DEVNULL for tests.

Apply this diff:

-        stdout=subprocess.PIPE,
-        stderr=subprocess.PIPE,
+        stdout=subprocess.DEVNULL,
+        stderr=subprocess.DEVNULL,

48-55: Use addCleanup for robust resource/env restoration even on setUp failures.
Ensure etcd is stopped and env var restored if setUp fails midway.

Apply this diff:

     def setUp(self):
-        # Set the protocol buffers implementation to python
-        os.environ["PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION"] = "python"
+        # Set the protocol buffers implementation to python
+        prev_pb_impl = os.environ.get("PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION")
+        os.environ["PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION"] = "python"
+        def _restore_pb_impl():
+            if prev_pb_impl is None:
+                os.environ.pop("PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION", None)
+            else:
+                os.environ["PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION"] = prev_pb_impl
+        self.addCleanup(_restore_pb_impl)
@@
-        # Start etcd server
-        self.etcd_process = start_etcd_server()
+        # Start etcd server
+        self.etcd_process = start_etcd_server()
+        self.addCleanup(stop_etcd_server, self.etcd_process)
@@
     def tearDown(self):
         # Clean up test keys after each test
         self._cleanup_test_keys()
-
-        # Stop etcd server
-        stop_etcd_server(self.etcd_process)
-
-        # Unset the protocol buffers implementation
-        del os.environ["PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION"]
+        # Process and env cleanup handled by addCleanup() in setUp()

This improves resilience for failures in setUp.

Also applies to: 70-79

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1eb6531 and ea146cd.

📒 Files selected for processing (1)
  • tests/unittest/disaggregated/test_remoteDictionary.py (3 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{h,hpp,hh,hxx,cpp,cxx,cc,cu,cuh,py}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

Use only spaces, no tabs; indent with 4 spaces.

Files:

  • tests/unittest/disaggregated/test_remoteDictionary.py
**/*.py

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

**/*.py: Python code must target Python 3.8+.
Indent Python code with 4 spaces; do not use tabs.
Maintain module namespace when importing; prefer 'from package.subpackage import foo' then 'foo.SomeClass()' instead of importing the class directly.
Python filenames should be snake_case (e.g., some_file.py).
Python classes use PascalCase names.
Functions and methods use snake_case names.
Local variables use snake_case; prefix 'k' for variables that start with a number (e.g., k_99th_percentile).
Global variables use upper SNAKE_CASE prefixed with 'G' (e.g., G_MY_GLOBAL).
Constants use upper SNAKE_CASE (e.g., MY_CONSTANT).
Avoid shadowing variables from an outer scope.
Initialize all externally visible members of a class in the constructor.
Prefer docstrings for interfaces that may be used outside a file; comments for in-function or file-local interfaces.
Use Google-style docstrings for classes and functions (Sphinx-parsable).
Document attributes and variables inline so they render under the class/function docstring.
Avoid reflection when a simpler, explicit approach suffices (e.g., avoid dict(**locals()) patterns).
In try/except, catch the most specific exceptions possible.
For duck-typing try/except, keep the try body minimal and use else for the main logic.

Files:

  • tests/unittest/disaggregated/test_remoteDictionary.py
**/*.{cpp,cxx,cc,h,hpp,hh,hxx,cu,cuh,py}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

Prepend the NVIDIA Apache-2.0 copyright header with current year to the top of all source files (e.g., .cpp, .h, .cu, .py).

Files:

  • tests/unittest/disaggregated/test_remoteDictionary.py
🪛 Ruff (0.13.1)
tests/unittest/disaggregated/test_remoteDictionary.py

21-21: Avoid specifying long messages outside the exception class

(TRY003)

⏰ 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
🔇 Additional comments (2)
tests/unittest/disaggregated/test_remoteDictionary.py (2)

3-3: LGTM: Necessary import for socket polling.
The added socket import is required for the new readiness check.


59-60: LGTM: Readiness wait before client creation.
This should reduce flakes from early client initialization.

Please confirm this eliminates the prior flakiness in CI across all runners (IPv4/IPv6 environments).

@pcastonguay
Copy link
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #19995 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #19995 [ run ] completed with state SUCCESS
/LLM/main/L0_MergeRequest_PR pipeline #15057 completed with status: 'FAILURE'

@pcastonguay
Copy link
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #20094 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #20094 [ run ] completed with state SUCCESS
/LLM/main/L0_MergeRequest_PR pipeline #15140 completed with status: 'FAILURE'

@pcastonguay
Copy link
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #20265 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #20265 [ run ] completed with state SUCCESS
/LLM/main/L0_MergeRequest_PR pipeline #15280 completed with status: 'SUCCESS'
Pipeline passed with automatic retried tests. Check the rerun report for details.

@pcastonguay pcastonguay merged commit 6396cb9 into NVIDIA:main Sep 30, 2025
5 checks passed
faradawn pushed a commit to faradawn/TensorRT-LLM that referenced this pull request Oct 2, 2025
…nit test (NVIDIA#8006)

Signed-off-by: Patrice Castonguay <[email protected]>
Signed-off-by: Faradawn Yang <[email protected]>
pcastonguay added a commit to pcastonguay/TensorRT-LLM that referenced this pull request Oct 10, 2025
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