MCPcopy
hub / github.com/ModelTC/LightLLM / healthcheck

Function healthcheck

lightllm/server/api_http.py:144–157  ·  view source on GitHub ↗
(request: Request)

Source from the content-addressed store, hash-verified

142@app.get("/health", summary="Check server health")
143@app.head("/health", summary="Check server health")
144async def healthcheck(request: Request):
145 if g_objs.args.run_mode == "pd_master":
146 return JSONResponse({"message": "Ok"}, status_code=200)
147
148 if os.environ.get("DEBUG_HEALTHCHECK_RETURN_FAIL") == "true":
149 return JSONResponse({"message": "Error"}, status_code=503)
150 from lightllm.utils.health_check import health_check, health_obj
151
152 health_task = asyncio.create_task(health_check(g_objs.args, g_objs.httpserver_manager, None))
153 if not health_obj.is_health():
154 await health_task
155 return JSONResponse(
156 {"message": "Ok" if health_obj.is_health() else "Error"}, status_code=200 if health_obj.is_health() else 503
157 )
158
159
160@app.get("/token_load", summary="Get the current server's load of tokens")

Callers

nothing calls this directly

Calls 3

health_checkFunction · 0.90
is_healthMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected