mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2026-05-12 05:00:07 +08:00
[Misc] Improve readability of get_open_port function. (#17024)
Signed-off-by: gitover22 <qidizou88@gmail.com>
This commit is contained in:
parent
d0da99fb70
commit
ec69124eb4
@ -628,12 +628,12 @@ def get_open_port() -> int:
|
|||||||
process. Currently it uses 2 ports.
|
process. Currently it uses 2 ports.
|
||||||
"""
|
"""
|
||||||
if "VLLM_DP_MASTER_PORT" in os.environ:
|
if "VLLM_DP_MASTER_PORT" in os.environ:
|
||||||
dp_port = envs.VLLM_DP_MASTER_PORT
|
dp_master_port = envs.VLLM_DP_MASTER_PORT
|
||||||
|
reserved_port_range = range(dp_master_port, dp_master_port + 10)
|
||||||
while True:
|
while True:
|
||||||
port = _get_open_port()
|
candidate_port = _get_open_port()
|
||||||
if dp_port <= port < dp_port + 10:
|
if candidate_port not in reserved_port_range:
|
||||||
continue
|
return candidate_port
|
||||||
return port
|
|
||||||
return _get_open_port()
|
return _get_open_port()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user