-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[Misc] adjust for ipv6 for mookcacke url parse #20107
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
[Misc] adjust for ipv6 for mookcacke url parse #20107
Conversation
👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels. Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging. To run CI, PR reviewers can either: Add 🚀 |
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.
Summary of Changes
Hello @andyxning, 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 introduces comprehensive IPv6 support for URL parsing within the mooncake_pipe
module, specifically for prefill_url
and decode_url
configurations. It refactors existing IP and port handling logic by introducing new utility functions that correctly parse and construct network addresses, ensuring compatibility with both IPv4 and IPv6 formats.
Highlights
- Enhanced IP/Port Parsing: Implemented new utility functions (
split_ip_port
,join_ip_port
) invllm/utils.py
to robustly parse and format IP addresses and ports, including proper handling of IPv6 bracket notation. - IPv6 Compatibility for Mooncake KV Transfer: Updated the
mooncake_pipe
module to leverage these new utility functions, enablingprefill_url
anddecode_url
configurations to correctly interpret and construct URLs for IPv6 addresses. - Improved ZMQ URI Construction: Modified the
_setup_metadata_sockets
method to use themake_zmq_path
utility, ensuring consistent and correct ZeroMQ URI formatting for both IPv4 and IPv6. - Comprehensive Unit Tests: Added new unit tests in
tests/test_utils.py
to validate the correctness and robustness of the newly introduced IP/port parsing and joining utilities across various IPv4 and IPv6 scenarios, including error cases.
Using Gemini Code Assist
The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
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 .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and 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 to provide feedback.
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
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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.
Code Review
The code changes introduce IPv6 support for mookcache URL parsing. The changes include adding new functions for splitting and joining IP addresses and ports, and updating the mooncake pipe to use these functions. The test suite is also updated to include tests for the new functions. The changes look good, but there are a few minor issues that should be addressed.
tests/test_utils.py
Outdated
# valid ipv6 | ||
assert split_ip_port("[::1]:5555") == ("::1", 5555) | ||
# invalid ipv6 | ||
with pytest.raises(AssertionError): |
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.
tests/test_utils.py
Outdated
with pytest.raises(AssertionError): | ||
# multi colon | ||
assert split_ip_port("[::1]::5555") | ||
with pytest.raises(AssertionError): |
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.
tests/test_utils.py
Outdated
with pytest.raises(AssertionError): | ||
# tailing colon | ||
assert split_ip_port("[::1]:5555:") | ||
with pytest.raises(AssertionError): |
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.
vllm/utils.py
Outdated
assert len(parts) == 2 | ||
port = parts[1] |
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.
0467750
to
0a67b70
Compare
vllm/utils.py
Outdated
@@ -628,14 +628,34 @@ def is_valid_ipv6_address(address: str) -> bool: | |||
return False | |||
|
|||
|
|||
def split_ip_port(ip_port: str) -> Tuple[str, int]: |
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.
using host
here instead of ip
would be more consistent with your variable names. The function doesn't require it to be IP addresses, so host is a little more accurate
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.
@russellb PTAL.
0a67b70
to
c4cdb9a
Compare
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.
I left a couple other minor suggestions, but it's not a blocker.
approved, thanks!
tests/test_utils.py
Outdated
assert get_tcp_uri("::1", 5555) == "tcp://[::1]:5555" | ||
|
||
|
||
def test_split_ip_port(): |
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.
adding invalid IPv6 here would be good, too
vllm/utils.py
Outdated
if host_port.startswith('['): | ||
host, port = host_port.rsplit(']', 1) | ||
host = host[1:] | ||
port = port.split(':')[1] | ||
return host, int(port) | ||
else: | ||
host, port = host_port.split(':') | ||
return host, int(port) |
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.
This could be slightly improved to raise ValueError
directly with a message explaining that the string is an invalid combination of host + port. Right now it'll be something less clear, like ValueError: too many values to unpack (expected 2)
, depending on how it was formatted
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.
Will refactor in a new PR later.
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.
no big deal either way
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.
ok
Head branch was pushed to by a user without write access
59ff2fb
to
dd68223
Compare
# none int port | ||
assert split_host_port("127.0.0.1:5555a") | ||
|
||
# valid ipv6 |
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.
@russellb there are ready invalid ipv6 tests here. Can you give more details.
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.
you're right, i was just blind, thank you
This pull request has merge conflicts that must be resolved before it can be |
dd68223
to
2fbb402
Compare
e6b55fc
to
44702e4
Compare
@russellb Can you pls take a look at the ci failures. Seems the failure has nothing to do with this PR. |
Some other PRs are also failed with docker build image. |
@DarkLight1337 Could you pls take a loot at this. |
Signed-off-by: Andy Xie <andy.xning@gmail.com>
44702e4
to
c465ee0
Compare
Signed-off-by: Andy Xie <andy.xning@gmail.com>
Signed-off-by: Andy Xie <andy.xning@gmail.com>
Signed-off-by: Andy Xie <andy.xning@gmail.com>
Signed-off-by: Andy Xie <andy.xning@gmail.com>
Signed-off-by: Andy Xie <andy.xning@gmail.com> Signed-off-by: avigny <47987522+avigny@users.noreply.github.com>
Signed-off-by: Andy Xie <andy.xning@gmail.com>
Signed-off-by: Andy Xie <andy.xning@gmail.com>
Signed-off-by: Andy Xie <andy.xning@gmail.com> Signed-off-by: Jinzhen Lin <linjinzhen@hotmail.com>
Signed-off-by: Andy Xie <andy.xning@gmail.com>
Essential Elements of an Effective PR Description Checklist
supported_models.md
andexamples
for a new model.Purpose
Currently, mookcache kv transfer config parsing does not support ipv6. Adjust the
prefill_url
anddecode_url
parser logic .Test Plan
Add ut for newly added function.
Test Result
Passed
(Optional) Documentation Update