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
b74a1258
Unverified
Commit
b74a1258
authored
Aug 20, 2024
by
youkaichao
Committed by
GitHub
Aug 20, 2024
Browse files
[ci] try to log process using the port to debug the port usage (#7711)
parent
66a9e713
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
vllm/entrypoints/launcher.py
vllm/entrypoints/launcher.py
+7
-0
vllm/utils.py
vllm/utils.py
+10
-0
No files found.
vllm/entrypoints/launcher.py
View file @
b74a1258
...
...
@@ -10,6 +10,7 @@ from vllm import envs
from
vllm.engine.async_llm_engine
import
AsyncEngineDeadError
from
vllm.engine.protocol
import
AsyncEngineClient
from
vllm.logger
import
init_logger
from
vllm.utils
import
find_process_using_port
logger
=
init_logger
(
__name__
)
...
...
@@ -48,6 +49,12 @@ async def serve_http(app: FastAPI, engine: AsyncEngineClient,
await
server_task
return
dummy_shutdown
()
except
asyncio
.
CancelledError
:
port
=
uvicorn_kwargs
[
"port"
]
process
=
find_process_using_port
(
port
)
if
process
is
not
None
:
logger
.
debug
(
"port %s is used by process %s launched with command:
\n
%s"
,
port
,
process
,
" "
.
join
(
process
.
cmdline
()))
logger
.
info
(
"Gracefully stopping http server"
)
return
server
.
shutdown
()
...
...
vllm/utils.py
View file @
b74a1258
...
...
@@ -547,6 +547,16 @@ def get_open_port() -> int:
return
s
.
getsockname
()[
1
]
def
find_process_using_port
(
port
:
int
)
->
Optional
[
psutil
.
Process
]:
for
conn
in
psutil
.
net_connections
():
if
conn
.
laddr
.
port
==
port
:
try
:
return
psutil
.
Process
(
conn
.
pid
)
except
psutil
.
NoSuchProcess
:
return
None
return
None
def
update_environment_variables
(
envs
:
Dict
[
str
,
str
]):
for
k
,
v
in
envs
.
items
():
if
k
in
os
.
environ
and
os
.
environ
[
k
]
!=
v
:
...
...
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