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

Signed-off-by: yang.xiao <yang.xiao@daocloud.io>
This commit is contained in:
Xiao Yang
2026-02-01 01:42:59 +08:00
committed by GitHub
parent ce0afe2451
commit 2238a12c13

View File

@@ -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)