Blame view

scripts/build_suggestions.sh 854 Bytes
f251cf2d   tangwang   suggestion全量索引程序跑通
1
2
3
4
5
  #!/usr/bin/env bash
  #
  # Convenience script to rebuild suggestion index for a tenant.
  #
  # Usage:
ff9efda0   tangwang   suggest
6
7
8
9
10
  #   # full rebuild + alias publish (default)
  #   ./scripts/build_suggestions.sh <tenant_id> --mode full --days 30
  #
  #   # incremental update from watermark
  #   ./scripts/build_suggestions.sh <tenant_id> --mode incremental
f251cf2d   tangwang   suggestion全量索引程序跑通
11
12
13
14
15
16
  #
  
  set -euo pipefail
  
  if [ $# -lt 1 ]; then
    echo "Usage: $0 <tenant_id> [extra args...]"
ff9efda0   tangwang   suggest
17
18
    echo "Example (full): $0 162 --mode full --days 30 --publish-alias"
    echo "Example (incremental): $0 162 --mode incremental --overlap-minutes 30"
f251cf2d   tangwang   suggestion全量索引程序跑通
19
20
21
22
23
24
25
26
27
28
    exit 1
  fi
  
  TENANT_ID="$1"
  shift || true
  
  ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
  
  cd "$ROOT_DIR"
  
ff9efda0   tangwang   suggest
29
30
31
32
33
34
  PY_BIN="${PYTHON_BIN:-$ROOT_DIR/.venv/bin/python}"
  if [ ! -x "$PY_BIN" ]; then
    PY_BIN="python3"
  fi
  
  "$PY_BIN" main.py build-suggestions \
f251cf2d   tangwang   suggestion全量索引程序跑通
35
36
    --tenant-id "$TENANT_ID" \
    "$@"