[Diffusion] add health endpoints to diffusion server (#13329)
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
from contextlib import asynccontextmanager
|
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.entrypoints.openai import image_api, video_api
|
||||||
from sglang.multimodal_gen.runtime.server_args import ServerArgs, prepare_server_args
|
from sglang.multimodal_gen.runtime.server_args import ServerArgs, prepare_server_args
|
||||||
@@ -32,13 +32,32 @@ async def lifespan(app: FastAPI):
|
|||||||
scheduler_client.close()
|
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):
|
def create_app(server_args: ServerArgs):
|
||||||
"""
|
"""
|
||||||
Create and configure the FastAPI application instance.
|
Create and configure the FastAPI application instance.
|
||||||
"""
|
"""
|
||||||
app = FastAPI(lifespan=lifespan)
|
app = FastAPI(lifespan=lifespan)
|
||||||
|
|
||||||
|
app.include_router(health_router)
|
||||||
|
|
||||||
app.include_router(image_api.router)
|
app.include_router(image_api.router)
|
||||||
app.include_router(video_api.router)
|
app.include_router(video_api.router)
|
||||||
|
|
||||||
app.state.server_args = server_args
|
app.state.server_args = server_args
|
||||||
return app
|
return app
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
"expected_median_denoise_ms": 718.0,
|
"expected_median_denoise_ms": 718.0,
|
||||||
"stages_ms": {
|
"stages_ms": {
|
||||||
"InputValidationStage": 14,
|
"InputValidationStage": 14,
|
||||||
"ImageEncodingStage": 990.0,
|
"ImageEncodingStage": 1400.0,
|
||||||
"ImageVAEEncodingStage": 252.76,
|
"ImageVAEEncodingStage": 252.76,
|
||||||
"ConditioningStage": 0.13,
|
"ConditioningStage": 0.13,
|
||||||
"TimestepPreparationStage": 13.78,
|
"TimestepPreparationStage": 13.78,
|
||||||
|
|||||||
Reference in New Issue
Block a user