INNER CODE UNIT · Python

health

scub-france/docling-Studio · document-parser/main.py:107

async def health() -> HealthResponse:
    """Health check endpoint — verifies database connectivity."""
    db_status = "ok"
    try:
        async with get_connection() as db:
            await db.execute("SELECT 1")
    except Exception:
        db_status = "error"
        logger.warning("Health check: database unreachable", exc_info=True)

    # Tolerates a missing container: the app is importable (and this endpoint
    # answerable) before lifespan has run, which is how the API tests mount it.
    state: AppState = getattr(app.state, "container", None) or AppState()
    runner = state.reasoning_runner
    return HealthResponse(
        status="ok" if db_status == "ok" else "degraded",
        version=settings.app_version,
        engine=settings.conversion_engine,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…