[Diffusion] add health endpoints to diffusion server (#13329)

This commit is contained in:
Adarsh Shirawalmath
2025-11-15 16:42:37 +05:30
committed by GitHub
parent d91b16eb16
commit 3f400f25df
2 changed files with 21 additions and 2 deletions

View File

@@ -3,7 +3,7 @@
import asyncio
from contextlib import asynccontextmanager
from fastapi import FastAPI
from fastapi import APIRouter, FastAPI
from sglang.multimodal_gen.runtime.entrypoints.openai import image_api, video_api
from sglang.multimodal_gen.runtime.server_args import ServerArgs, prepare_server_args
@@ -32,13 +32,32 @@ async def lifespan(app: FastAPI):
scheduler_client.close()
# Health router
health_router = APIRouter()
@health_router.get("/health")
async def health():
return {"status": "ok"}
@health_router.get("/health_generate")
async def health_generate():
# TODO : health generate endpoint
return {"status": "ok"}
def create_app(server_args: ServerArgs):
"""
Create and configure the FastAPI application instance.
"""
app = FastAPI(lifespan=lifespan)
app.include_router(health_router)
app.include_router(image_api.router)
app.include_router(video_api.router)
app.state.server_args = server_args
return app

View File

@@ -58,7 +58,7 @@
"expected_median_denoise_ms": 718.0,
"stages_ms": {
"InputValidationStage": 14,
"ImageEncodingStage": 990.0,
"ImageEncodingStage": 1400.0,
"ImageVAEEncodingStage": 252.76,
"ConditioningStage": 0.13,
"TimestepPreparationStage": 13.78,