Conversation
|
MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅ |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors the warmup_connections setting from a boolean to an integer, providing more granular control over connection warming. However, a critical security issue was identified in src/inference_endpoint/utils/benchmark_httpclient.py where manual ZMQ context management could lead to resource leaks and potential denial of service if exceptions occur during benchmark execution. This manual context manager handling is not robust; using a with statement is recommended for proper resource management. Otherwise, the changes are consistently applied and improve the flexibility of the HTTP client configuration.
There was a problem hiding this comment.
Pull request overview
This PR changes the warmup_connections configuration field from bool to int across the codebase, enabling more granular control over TCP connection warmup. The old boolean semantics (True/False) are replaced with integer semantics where -1 means auto (50% of pool), 0 means disabled, and >0 specifies an explicit total count. Additionally, the benchmark_httpclient.py utility is updated to properly manage a ZMQ context and pass it through to the AsyncHttpEndpointClient.
Changes:
- Changed
warmup_connectionstype frombooltointin both config schemas (config.py,schema.py) and updated all call sites (tests and production code) fromFalseto0andTrueto-1. - Added ZMQ context management to
run_benchmark()inbenchmark_httpclient.py, creating aManagedZMQContextand passing it through_create_clienttoAsyncHttpEndpointClient. - Updated the
create_futures_clienttest helper signature and docstring to reflect the newinttype.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/inference_endpoint/endpoint_client/config.py |
Changed warmup_connections type from bool to int with -1 default |
src/inference_endpoint/config/schema.py |
Updated ClientSettings.warmup_connections from bool to int with documentation |
src/inference_endpoint/commands/benchmark.py |
Updated default from True to -1 in CLI config builder |
src/inference_endpoint/commands/probe.py |
Changed warmup_connections=False to warmup_connections=0 |
src/inference_endpoint/utils/benchmark_httpclient.py |
Added ZMQ context management and zmq_context parameter; changed warmup to 0 |
tests/integration/endpoint_client/conftest.py |
Updated helper function type annotation and docstring |
tests/integration/endpoint_client/test_worker.py |
Changed False to 0 in 4 locations |
tests/integration/endpoint_client/test_worker_manager.py |
Changed False to 0 in 2 locations |
tests/integration/endpoint_client/test_http_client.py |
Changed False to 0 in 2 locations |
tests/integration/endpoint_client/test_sglang_adapter.py |
Changed False to 0 |
tests/integration/endpoint_client/test_external_serving.py |
Changed False to 0 |
tests/integration/commands/test_benchmark_command.py |
Changed False to 0 in 4 locations |
tests/integration/test_end_to_end_oracle.py |
Changed False to 0 |
tests/performance/conftest.py |
Changed False to 0 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
What does this PR do?
Type of change
Related issues
Testing
Checklist