better logging

This commit is contained in:
Holden
2026-06-10 18:31:43 -04:00
parent b8445a1bb3
commit a2f18484a6
4 changed files with 203 additions and 37 deletions
+36 -5
View File
@@ -1,17 +1,48 @@
#!/bin/bash
set -e
export PYTHONUNBUFFERED=1
# Function to log model status before each run
check_models() {
echo "📦 Checking models..."
if [ -d "/models/insightface/models/buffalo_l" ]; then
echo " ✅ InsightFace Buffalo_L: downloaded"
else
echo " ⬇️ InsightFace Buffalo_L: downloading (~300MB)..."
fi
if [ -d "/models/huggingface/hub" ] && [ "$(find /models/huggingface/hub -maxdepth 1 -type d 2>/dev/null | wc -l)" -gt 1 ]; then
echo " ✅ HuggingFace models: downloaded"
else
echo " ⬇️ HuggingFace models: downloading (SigLIP ~1GB, YOLOv9c ~500MB)..."
fi
echo "🚀 Starting if-curator..."
}
SCHEDULE="${CRON_SCHEDULE:-}"
AUTO="${AUTO_MODE:-false}"
# Check if interactive mode is viable
if [ "$AUTO" != "true" ] && [ ! -t 0 ]; then
echo "❌ AUTO_MODE is not enabled and no TTY is attached."
echo "❌ Set AUTO_MODE=true for headless/automated runs."
exit 1
fi
# Always run once on startup
echo "▶ Running on startup..."
check_models
uv run if-curator
if [ -z "$SCHEDULE" ]; then
echo "▶ No CRON_SCHEDULE set — running once"
uv run if-curator
echo "▶ No CRON_SCHEDULE set — exiting"
exit 0
fi
echo "▶ CRON_SCHEDULE set to: $SCHEDULE"
echo "▶ Running if-curator on schedule..."
# Hand off to the Python scheduler
echo "▶ Switching to scheduled mode..."
exec uv run python3 /app/scheduler.py