Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
ec69124e
Unverified
Commit
ec69124e
authored
Apr 23, 2025
by
huafeng
Committed by
GitHub
Apr 23, 2025
Browse files
[Misc] Improve readability of get_open_port function. (#17024)
Signed-off-by:
gitover22
<
qidizou88@gmail.com
>
parent
d0da99fb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
vllm/utils.py
vllm/utils.py
+5
-5
No files found.
vllm/utils.py
View file @
ec69124e
...
...
@@ -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
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment