-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathgunicorn.conf.py
More file actions
23 lines (19 loc) · 1.45 KB
/
Copy pathgunicorn.conf.py
File metadata and controls
23 lines (19 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""Gunicorn configuration for tode web server."""
import multiprocessing
import os
# ── binding ───────────────────────────────────────────────────────────────────
port = int(os.environ.get("PORT", os.environ.get("TODE_PORT", "8000")))
bind = f"0.0.0.0:{port}"
# ── workers ───────────────────────────────────────────────────────────────────
workers = int(os.environ.get("WEB_CONCURRENCY", multiprocessing.cpu_count() * 2 + 1))
worker_class = "uvicorn.workers.UvicornWorker"
# ── timeouts ──────────────────────────────────────────────────────────────────
# 120s allows slow YOLO inference on CPU without killing the worker
timeout = int(os.environ.get("GUNICORN_TIMEOUT", "120"))
keepalive = 5
graceful_timeout = 30
# ── logging ───────────────────────────────────────────────────────────────────
accesslog = "-"
errorlog = "-"
loglevel = os.environ.get("LOG_LEVEL", "info")
access_log_format = '%(h)s "%(r)s" %(s)s %(b)s %(M)sms'