fix: INSIGHTFACE_HOME path, entrypoint, caching default, CRON_SCHEDULE opt-in

- Dockerfile: ENV INSIGHTFACE_HOME=/models → /models/.insightface to
  match compose.yml and .env.example; the old value caused InsightFace
  to store models at /models/models/buffalo_l (double-appended subdir)
- entrypoint.sh: use /app/.venv/bin/winnow (installed entry point)
  instead of python -m winnow.cli
- config.py: ENABLE_CACHE default false → true; embedding cache is
  always beneficial in practice; users can opt out with ENABLE_CACHE=false
- compose.yml: comment out CRON_SCHEDULE so scheduling is opt-in;
  flip ENABLE_CACHE to commented opt-out to reflect new default
- README.md: update ENABLE_CACHE default documentation to true
- tests/test_config.py: update default assertion to match

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-12 05:36:47 +00:00
co-authored by Claude Sonnet 4.6
parent 125ce54c7f
commit 196b0a5147
6 changed files with 10 additions and 12 deletions
+1 -1
View File
@@ -71,7 +71,7 @@ RUN groupadd -g 568 apps && useradd -u 568 -g apps -m -s /bin/bash appuser \
WORKDIR /app
USER appuser
ENV HF_HOME=/models/huggingface INSIGHTFACE_HOME=/models
ENV HF_HOME=/models/huggingface INSIGHTFACE_HOME=/models/.insightface
HEALTHCHECK CMD test -f /app/entrypoint.sh || exit 1
ENTRYPOINT ["tini", "--", "/app/entrypoint.sh"]
+1 -1
View File
@@ -192,7 +192,7 @@ The first run after a fresh install downloads the embedding models (~1-2 GB). Su
| Variable | Default | Description |
| :--- | :--- | :--- |
| `FORCE_CPU` | `false` | Disable GPU — fall back to CPU for embedding computation |
| `ENABLE_CACHE` | `false` | Cache computed embeddings to disk (speeds up re-runs on the same library) |
| `ENABLE_CACHE` | `true` | Cache computed embeddings to disk (speeds up re-runs on the same library) |
| `CACHE_DIR` | `.if_cache` | Path for embedding cache and upload tracker files |
| `HF_HOME` | *(system)* | HuggingFace model cache location (SigLIP) |
| `INSIGHTFACE_HOME` | *(system)* | InsightFace model cache location (Buffalo_L) |
+4 -5
View File
@@ -35,7 +35,7 @@ services:
# ── Caching & Models ──────────────────────────────────────────────────
- FORCE_CPU=false
- ENABLE_CACHE=true
# - ENABLE_CACHE=false # Disable embedding cache (default: true)
- CACHE_DIR=/app/.if_cache
- HF_HOME=/models/huggingface
- INSIGHTFACE_HOME=/models/.insightface
@@ -47,10 +47,9 @@ services:
# ── Scheduling ────────────────────────────────────────────────────────
# Cron expression (unset = run once and exit)
# Every Sunday at 3 AM:
- CRON_SCHEDULE=0 3 * * 0
# - CRON_SCHEDULE=0 3 1 * *
# - CRON_SCHEDULE=*/30 * * * *
# - CRON_SCHEDULE=0 3 * * 0 # Every Sunday at 3 AM
# - CRON_SCHEDULE=0 3 1 * * # First of every month
# - CRON_SCHEDULE=*/30 * * * * # Every 30 minutes
volumes:
# Replace with absolute paths on your host, e.g. /opt/winnow/models
- /path/to/winnow/models:/models
+1 -1
View File
@@ -4,7 +4,7 @@ export PYTHONUNBUFFERED=1
# 1. Run the job immediately on startup
echo "▶ Running on startup..."
/app/.venv/bin/python -m winnow.cli
/app/.venv/bin/winnow
# 2. If a schedule exists, start the scheduler
if [ -n "${CRON_SCHEDULE:-}" ]; then
+1 -1
View File
@@ -25,7 +25,7 @@ def test_config_loads_defaults(monkeypatch):
assert cfg.FACE_MARGIN == 0.15
assert cfg.USE_FULL_RESOLUTION is True
assert cfg.ENABLE_FACE_ALIGNMENT is True
assert cfg.ENABLE_CACHE is False
assert cfg.ENABLE_CACHE is True
_Config.reset()
+2 -3
View File
@@ -39,8 +39,7 @@ class _Config:
USE_FULL_RESOLUTION: bool = True
ENABLE_FACE_ALIGNMENT: bool = True
# Caching (opt-in to avoid unexpected files)
ENABLE_CACHE: bool = False
ENABLE_CACHE: bool = True
CACHE_DIR: str = ".if_cache"
def __new__(cls) -> "_Config":
@@ -64,7 +63,7 @@ class _Config:
self.FACE_MARGIN = float(os.getenv("FACE_MARGIN", "0.15"))
self.USE_FULL_RESOLUTION = os.getenv("USE_FULL_RESOLUTION", "true").lower() in ("true", "1", "yes")
self.ENABLE_FACE_ALIGNMENT = os.getenv("ENABLE_FACE_ALIGNMENT", "true").lower() in ("true", "1", "yes")
self.ENABLE_CACHE = os.getenv("ENABLE_CACHE", "false").lower() in ("true", "1", "yes")
self.ENABLE_CACHE = os.getenv("ENABLE_CACHE", "true").lower() in ("true", "1", "yes")
self.CACHE_DIR = os.getenv("CACHE_DIR", ".if_cache")
# Fall back to config file for non-sensitive values (API_KEY not stored here)