← back to Dw Photo Capture
visual-search/embed-nightly-mac2.sh
21 lines
#!/bin/bash
# Mac2 nightly embed top-up — keeps CLIP coverage of the ACTIVE catalog from decaying
# as new products land. Runs both embedders resumably (each skips already-done rows),
# then hot-reloads the search index. Safe to run any time; $0 local.
# launchd: com.steve.visual-search-embed-nightly (see plist next to this script).
set -u
cd "$(dirname "$0")" || exit 1
export DW_UNIFIED_DB="${DW_UNIFIED_DB:-postgresql://stevestudio2@/dw_unified?host=/tmp}"
PY=./.venv-similar/bin/python
LOG=embed-nightly.log
echo "$(date -u +%FT%TZ) nightly: start" >> "$LOG"
# 1) vendor_catalog stragglers (existing embedder, resumable)
nice -n 15 "$PY" embed_catalog.py --workers 16 --limit 20000 >> "$LOG" 2>&1
# 2) shopify-only actives (gap embedder, resumable via negative-key placeholders)
nice -n 15 "$PY" embed_shopify_gap.py --workers 16 >> "$LOG" 2>&1
# 3) refresh the in-RAM index so new vectors are searchable
curl -s --max-time 120 http://127.0.0.1:9914/reload >> "$LOG" 2>&1
echo "" >> "$LOG"
echo "$(date -u +%FT%TZ) nightly: done" >> "$LOG"