yangdx
commited on
Commit
·
d0ba3dc
1
Parent(s):
84bb9ab
feat(health-check): add pipeline busy status to health endpoint
Browse files- lightrag/api/lightrag_server.py +37 -30
lightrag/api/lightrag_server.py
CHANGED
@@ -421,37 +421,44 @@ def create_app(args):
|
|
421 |
@app.get("/health", dependencies=[Depends(combined_auth)])
|
422 |
async def get_status():
|
423 |
"""Get current system status"""
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
|
|
|
|
|
|
430 |
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
|
|
|
|
|
|
|
|
455 |
|
456 |
# Custom StaticFiles class to prevent caching of HTML files
|
457 |
class NoCacheStaticFiles(StaticFiles):
|
|
|
421 |
@app.get("/health", dependencies=[Depends(combined_auth)])
|
422 |
async def get_status():
|
423 |
"""Get current system status"""
|
424 |
+
try:
|
425 |
+
pipeline_status = await get_namespace_data("pipeline_status")
|
426 |
+
|
427 |
+
username = os.getenv("AUTH_USERNAME")
|
428 |
+
password = os.getenv("AUTH_PASSWORD")
|
429 |
+
if not (username and password):
|
430 |
+
auth_mode = "disabled"
|
431 |
+
else:
|
432 |
+
auth_mode = "enabled"
|
433 |
|
434 |
+
return {
|
435 |
+
"status": "healthy",
|
436 |
+
"working_directory": str(args.working_dir),
|
437 |
+
"input_directory": str(args.input_dir),
|
438 |
+
"configuration": {
|
439 |
+
# LLM configuration binding/host address (if applicable)/model (if applicable)
|
440 |
+
"llm_binding": args.llm_binding,
|
441 |
+
"llm_binding_host": args.llm_binding_host,
|
442 |
+
"llm_model": args.llm_model,
|
443 |
+
# embedding model configuration binding/host address (if applicable)/model (if applicable)
|
444 |
+
"embedding_binding": args.embedding_binding,
|
445 |
+
"embedding_binding_host": args.embedding_binding_host,
|
446 |
+
"embedding_model": args.embedding_model,
|
447 |
+
"max_tokens": args.max_tokens,
|
448 |
+
"kv_storage": args.kv_storage,
|
449 |
+
"doc_status_storage": args.doc_status_storage,
|
450 |
+
"graph_storage": args.graph_storage,
|
451 |
+
"vector_storage": args.vector_storage,
|
452 |
+
"enable_llm_cache_for_extract": args.enable_llm_cache_for_extract,
|
453 |
+
},
|
454 |
+
"core_version": core_version,
|
455 |
+
"api_version": __api_version__,
|
456 |
+
"auth_mode": auth_mode,
|
457 |
+
"pipeline_busy": pipeline_status.get("busy", False)
|
458 |
+
}
|
459 |
+
except Exception as e:
|
460 |
+
logger.error(f"Error getting health status: {str(e)}")
|
461 |
+
raise HTTPException(status_code=500, detail=str(e))
|
462 |
|
463 |
# Custom StaticFiles class to prevent caching of HTML files
|
464 |
class NoCacheStaticFiles(StaticFiles):
|