|
1 | 1 | # SPDX-License-Identifier: Apache-2.0 |
2 | 2 | # SPDX-FileCopyrightText: Copyright contributors to the vLLM project |
3 | 3 |
|
| 4 | +import json |
4 | 5 | import logging |
5 | 6 | import os |
6 | 7 | import threading |
@@ -96,19 +97,30 @@ def __init__( |
96 | 97 | # Each card corresponds to a ZMQ address. |
97 | 98 | self.zmq_address = f"{self._hostname}:{self._port}" |
98 | 99 |
|
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 | | - |
104 | 100 | # If `proxy_ip` or `proxy_port` is `""`, |
105 | 101 | # then the ping thread will not be enabled. |
106 | 102 | proxy_ip = self.config.get_from_extra_config("proxy_ip", "") |
107 | 103 | proxy_port = self.config.get_from_extra_config("proxy_port", "") |
108 | 104 | if proxy_ip == "" or proxy_port == "": |
109 | 105 | self.proxy_address = "" |
| 106 | + self.http_address = "" |
110 | 107 | else: |
111 | 108 | 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}" |
112 | 124 |
|
113 | 125 | self.context = zmq.Context() |
114 | 126 | self.router_socket = self.context.socket(zmq.ROUTER) |
|
0 commit comments