mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-24 18:35:56 +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.
|
||||
"""
|
||||
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:
|
||||
port = _get_open_port()
|
||||
if dp_port <= port < dp_port + 10:
|
||||
continue
|
||||
return port
|
||||
candidate_port = _get_open_port()
|
||||
if candidate_port not in reserved_port_range:
|
||||
return candidate_port
|
||||
return _get_open_port()
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user