Unverified Commit 2238a12c authored by Xiao Yang's avatar Xiao Yang Committed by GitHub
Browse files

[Misc] support collect_env for endpoint /server_info (#33246)


Signed-off-by: default avataryang.xiao <yang.xiao@daocloud.io>
parent ce0afe24
......@@ -2,6 +2,8 @@
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import asyncio
import functools
from typing import Annotated, Literal
import pydantic
......@@ -9,6 +11,7 @@ from fastapi import APIRouter, FastAPI, Query, Request
from fastapi.responses import JSONResponse
import vllm.envs as envs
from vllm.collect_env import get_env_info
from vllm.config import VllmConfig
from vllm.logger import init_logger
......@@ -32,6 +35,11 @@ def _get_vllm_env_vars():
return vllm_envs
@functools.lru_cache(maxsize=1)
def _get_system_env_info_cached():
return get_env_info()._asdict()
@router.get("/server_info")
async def show_server_info(
raw_request: Request,
......@@ -46,6 +54,7 @@ async def show_server_info(
),
# fallback=str is needed to handle e.g. torch.dtype
"vllm_env": _get_vllm_env_vars(),
"system_env": await asyncio.to_thread(_get_system_env_info_cached),
}
return JSONResponse(content=server_info)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment