Skip to content

Commit 23823ef

Browse files
yewentao256ilmarkov
authored andcommitted
[Chore] Optimize P2PNCCLEngine http_address (vllm-project#27488)
Signed-off-by: yewentao256 <zhyanwentao@126.com>
1 parent 3514ee2 commit 23823ef

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

vllm/distributed/kv_transfer/kv_connector/v1/p2p/p2p_nccl_engine.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# SPDX-License-Identifier: Apache-2.0
22
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
33

4+
import json
45
import logging
56
import os
67
import threading
@@ -96,19 +97,30 @@ def __init__(
9697
# Each card corresponds to a ZMQ address.
9798
self.zmq_address = f"{self._hostname}:{self._port}"
9899

99-
# The `http_port` must be consistent with the port of OpenAI.
100-
self.http_address = (
101-
f"{self._hostname}:{self.config.kv_connector_extra_config['http_port']}"
102-
)
103-
104100
# If `proxy_ip` or `proxy_port` is `""`,
105101
# then the ping thread will not be enabled.
106102
proxy_ip = self.config.get_from_extra_config("proxy_ip", "")
107103
proxy_port = self.config.get_from_extra_config("proxy_port", "")
108104
if proxy_ip == "" or proxy_port == "":
109105
self.proxy_address = ""
106+
self.http_address = ""
110107
else:
111108
self.proxy_address = proxy_ip + ":" + proxy_port
109+
# the `http_port` must be consistent with the port of OpenAI.
110+
http_port = self.config.get_from_extra_config("http_port", None)
111+
if http_port is None:
112+
example_cfg = {
113+
"kv_connector": "P2pNcclConnector",
114+
"kv_connector_extra_config": {"http_port": 8000},
115+
}
116+
example = (
117+
f"--port=8000 --kv-transfer-config='{json.dumps(example_cfg)}'"
118+
)
119+
raise ValueError(
120+
"kv_connector_extra_config.http_port is required. "
121+
f"Example: {example}"
122+
)
123+
self.http_address = f"{self._hostname}:{http_port}"
112124

113125
self.context = zmq.Context()
114126
self.router_socket = self.context.socket(zmq.ROUTER)

0 commit comments

Comments
 (0)