File size: 1,556 Bytes
0109502 | 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 41 42 43 44 45 46 47 48 | #!/usr/bin/env bash
# Run this once (whenever you sit down to run it — daily, every few days,
# whatever works) to process the NEXT batch of rows. It always resumes from
# wherever the last run left off, so running this once a day for a few weeks
# is exactly the intended usage. It's also fine to interrupt with Ctrl+C —
# see README "Stopping and recovering" section.
#
# Usage:
# scripts/run_daily.sh # dry run, 500 rows (safe default)
# scripts/run_daily.sh --real # real run (spends NIM API requests), 500 rows
# scripts/run_daily.sh --real 200 # real run, 200 rows this session
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
cd "$PROJECT_DIR"
if [ ! -d ".venv" ]; then
echo "No .venv/ found — run scripts/setup.sh first."
exit 1
fi
# shellcheck disable=SC1091
source .venv/bin/activate
# Keep dependencies in sync with requirements.txt automatically. This is
# fast (a few hundred ms) when everything is already installed, and only
# actually downloads/installs when requirements.txt has changed — it never
# touches anything outside .venv/.
pip install --quiet -r requirements.txt
MODE="--dry-run"
LIMIT="500"
if [ "${1:-}" = "--real" ]; then
MODE=""
LIMIT="${2:-500}"
elif [ -n "${1:-}" ]; then
LIMIT="$1"
fi
echo "Running: python main.py --limit $LIMIT $MODE"
echo "(Ctrl+C once = finish current record, save progress, stop cleanly.)"
echo
# shellcheck disable=SC2086
python main.py --limit "$LIMIT" $MODE
|