Added MinIO integration and logic
This commit is contained in:
15
api.py
15
api.py
@@ -9,6 +9,7 @@ from prometheus_fastapi_instrumentator import Instrumentator
|
||||
from router import ocr_router
|
||||
from utils.celery_utils import celery_app
|
||||
from utils.celery_utils import health_check as celery_health_check_task
|
||||
from utils.minio_utils import get_minio_client
|
||||
from utils.redis_utils import get_redis_client
|
||||
|
||||
logging.basicConfig(
|
||||
@@ -16,7 +17,7 @@ logging.basicConfig(
|
||||
)
|
||||
|
||||
|
||||
app = FastAPI(title="OCR GATEWAY", description="OCR API 서비스", docs_url="/docs")
|
||||
app = FastAPI(title="OCR LAB", description="OCR 성능 비교 분석", docs_url="/docs")
|
||||
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
@@ -58,7 +59,6 @@ def redis_health_check():
|
||||
@app.get("/health/Celery")
|
||||
async def celery_health_check():
|
||||
"""Celery 워커 상태 확인"""
|
||||
# celery_app = get_celery_app() # 이제 celery_utils에서 직접 임포트합니다.
|
||||
|
||||
try:
|
||||
# 1. 워커들에게 ping 보내기
|
||||
@@ -124,3 +124,14 @@ async def flower_health_check():
|
||||
status_code=500,
|
||||
detail=f"An error occurred during Flower health check: {str(e)}",
|
||||
)
|
||||
|
||||
|
||||
@app.get("/health/MinIO")
|
||||
def minio_health_check():
|
||||
try:
|
||||
client = get_minio_client()
|
||||
return {"status": "MinIO ok"}
|
||||
except Exception as e:
|
||||
raise HTTPException(
|
||||
status_code=500, detail=f"MinIO health check failed: {str(e)}"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user