File size: 1,002 Bytes
e480039 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | """Runtime launcher with extra startup timing for container boot analysis."""
import os
import time
from datetime import datetime, timezone
from app.core.config import settings
START_T0 = time.perf_counter()
def _log(message: str) -> None:
print(
f"{datetime.now(timezone.utc).isoformat()} | INFO | app.scripts.run_server | {message}",
flush=True,
)
def main() -> None:
port = os.environ.get("PORT", str(settings.PORT))
_log(f"launcher_start port={port} host={settings.HOST}")
import uvicorn
_log(f"uvicorn_import_complete duration_seconds={time.perf_counter() - START_T0:.3f}")
_log(
f"calling_uvicorn_run app=app.main:app host={settings.HOST} port={port} reload={settings.ENABLE_DEBUG}"
)
uvicorn.run(
"app.main:app",
host=settings.HOST,
port=int(port),
reload=settings.ENABLE_DEBUG,
log_level="info",
)
if __name__ == "__main__":
main() |