-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[https://nvbugs/5369366] [fix] Report failing requests #7060
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[https://nvbugs/5369366] [fix] Report failing requests #7060
Conversation
Signed-off-by: Rashid Kaleem <4079439+arekay@users.noreply.github.com>
📝 WalkthroughWalkthroughAdds an Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Caller
participant RequestFunc as async_request_*
participant Backend
Caller->>RequestFunc: invoke async request
alt Success
RequestFunc->>Backend: perform HTTP/SDK call
Backend-->>RequestFunc: 200 + payload
RequestFunc-->>Caller: RequestFuncOutput(result, exception_type=None)
else Non-200 (OpenAI completions)
RequestFunc->>RequestFunc: print "HTTP Error <status>: <response>"
RequestFunc-->>Caller: RequestFuncOutput(result=None, exception_type=None)
else Exception
RequestFunc->>RequestFunc: catch Exception as e
RequestFunc->>RequestFunc: set output.exception_type = e.__class__.__name__
RequestFunc-->>Caller: RequestFuncOutput(result=None, exception_type)
end
note right of RequestFunc: TODO: store status code for debugging (chat completions)
sequenceDiagram
autonumber
participant Benchmark
participant Progress as tqdm
participant Metrics as calculate_metrics
participant Outputs
Benchmark->>Progress: create progress (desc="Benchmarking")
Benchmark->>Metrics: compute metrics from outputs
loop per output
Metrics->>Outputs: read output[i]
alt output.exception_type present
Metrics->>Metrics: increment error_counts[exception_type]
else
Metrics->>Metrics: count success/completed
end
end
Metrics-->>Benchmark: return metrics (completed, latencies, error_counts)
Benchmark->>Benchmark: print totals, per-exception counts, and failed count
alt failures exist
Benchmark->>Benchmark: print failure banners and guidance
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
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 detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ 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)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
tensorrt_llm/serve/scripts/backend_request_func.py (2)
1-4: Add NVIDIA copyright header (2025) and consider postponed annotations for Py3.8.Per coding guidelines, prepend the NVIDIA copyright header. Also, this file uses PEP 585 generics (e.g., list[float]) which require Python 3.9+, or from future import annotations for 3.8. Add the future import to avoid runtime issues on 3.8.
Example header and future import to add at the very top of the file (outside the selected lines):
# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved. from __future__ import annotations
264-271: Populate exception_type on HTTP errors and in the exception path; include response details.
- Non-200 branch only prints but does not set exception_type, so HTTP failures won’t be counted downstream.
- The except clause does not bind the exception and thus cannot set exception_type. This also contradicts the PR summary.
- else: - print(f"HTTP Error {response.status}: {response}") - output.error = response.reason or "" - output.success = False - except Exception: + else: + # Log and capture HTTP failure type and reason/body (truncated). + body = await response.text() + print(f"HTTP Error {response.status}: {response.reason or ''} | Body: {body[:512]}") + output.error = f"{response.status} {response.reason or ''}" + output.exception_type = f"HTTP_{response.status}" + output.success = False + except Exception as e: output.success = False exc_info = sys.exc_info() output.error = "".join(traceback.format_exception(*exc_info)) + output.exception_type = e.__class__.__name__tensorrt_llm/serve/scripts/benchmark_serving.py (1)
1-4: Add NVIDIA copyright header (2025) and consider postponed annotations for Py3.8.Same as the other file: prepend the NVIDIA header and add from future import annotations to keep Python 3.8 compatibility with PEP 585 generics used throughout.
Example to add at the very top:
# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved. from __future__ import annotations
🧹 Nitpick comments (5)
tensorrt_llm/serve/scripts/backend_request_func.py (2)
49-49: Make exception_type Optional[str] to reflect None default.The field defaults to None but is typed as str. Use Optional[str] for correctness and clarity.
- exception_type: str = None # unset + exception_type: Optional[str] = None # Unset unless a failure occurs
136-141: Consider narrowing exception handling to aiohttp/asyncio/JSON errors.Catching Exception is pragmatic here, but for better signal and to avoid swallowing unexpected bugs, consider catching narrower exceptions (e.g., aiohttp.ClientError, asyncio.TimeoutError, json.JSONDecodeError) and re-raising unexpected ones.
If you want, I can prep a follow-up patch that narrows the exceptions and adds structured logging hooks.
Also applies to: 268-271, 401-406
tensorrt_llm/serve/scripts/benchmark_serving.py (3)
186-195: Remove duplicated logging and print once (optionally sorted).This block is repeated twice verbatim. Consolidate into a single section and consider sorting by count for readability.
- total_error_count = sum(error_counts.values()) - for exception_type, count in error_counts.items(): - print(f"Error type: {exception_type}, Count: {count} requests") - print(f"Total failed requests: {total_error_count}") - - total_error_count = sum(error_counts.values()) - for exception_type, count in error_counts.items(): - print(f"Error type: {exception_type}, Count: {count} requests") - print(f"Total failed requests: {total_error_count}") + if error_counts: + total_error_count = sum(error_counts.values()) + for exception_type, count in sorted(error_counts.items(), + key=lambda kv: kv[1], + reverse=True): + print(f"Error type: {exception_type}, Count: {count} requests") + print(f"Total failed requests: {total_error_count}")
451-455: Nice addition of totals; consider reusing failed_count.These prints are helpful. You can compute failed_count once here and reuse it below for the banner section to avoid recalculating.
- print("{:<40} {:<10}".format("Total requests:", len(outputs))) - print("{:<40} {:<10}".format("Successful requests:", metrics.completed)) - print("{:<40} {:<10}".format("Failed requests:", - len(outputs) - metrics.completed)) + failed_count = len(outputs) - metrics.completed + print("{:<40} {:<10}".format("Total requests:", len(outputs))) + print("{:<40} {:<10}".format("Successful requests:", metrics.completed)) + print("{:<40} {:<10}".format("Failed requests:", failed_count))
476-482: Failure banners are helpful; consider printing the per-type counts here too.The banners draw attention to failures (good). Consider also emitting the per-type summary here (or return it in the result dict) to avoid scrolling back. This pairs well with setting exception_type for HTTP failures in the request functions.
If you want, I can wire error_counts into the returned result (e.g., errors_by_type) and add conditional printing here.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
tensorrt_llm/serve/scripts/backend_request_func.py(4 hunks)tensorrt_llm/serve/scripts/benchmark_serving.py(5 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:
tensorrt_llm/serve/scripts/benchmark_serving.pytensorrt_llm/serve/scripts/backend_request_func.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:
tensorrt_llm/serve/scripts/benchmark_serving.pytensorrt_llm/serve/scripts/backend_request_func.py
🔇 Additional comments (1)
tensorrt_llm/serve/scripts/benchmark_serving.py (1)
353-355: Progress bar description addition looks good.Adding desc="Benchmarking" improves UX without affecting logic.
Signed-off-by: Rashid Kaleem <4079439+arekay@users.noreply.github.com>
@Tabrizian Here is what the output looks like with failing requests: |
Signed-off-by: Rashid Kaleem <4079439+arekay@users.noreply.github.com>
|
/bot run |
|
PR_Github #16727 [ run ] triggered by Bot |
|
PR_Github #16727 [ run ] completed with state |
Signed-off-by: Rashid Kaleem <4079439+arekay@users.noreply.github.com>
This PR makes failures in
benchmark_serving.pymore verbose. Prior to this change, the benchmark serving script would quietly consume the errors and the only indication is that the successful requests does not equal the total requests. This masks some key issues, one of which is the connection exhaustion when serving models. For instance, on llama2, running 64K requests on the client and server on the same node leads to around 30K failures - all due to the client not able to connect to the server due to port exhaustion.Summary by CodeRabbit
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 thestage-listparameter 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.mdand the
scripts/test_to_stage_mapping.pyhelper.kill
killKill all running builds associated with pull request.
skip
skip --comment COMMENTSkip 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-pipelineReuse 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.