Files
iomgaa 0290005129 fix(scripts): align build_trees.sh with project shell conventions
Codex 审查发现两处偏离既有脚本惯例:
1. conda activate 改为 PYTHON=$(conda run ...) + ${PYTHON} 模式
2. 追加 source .env 确保 TREE_BUILD_API_CONCURRENCY 等工程配置可用
2026-07-11 12:07:14 -04:00

40 lines
1.3 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# 批量并行建树(Spec-2
# 职责:对目录下所有视频并发构建三层 TreeIndex,断点续跑。
#
# 用法:
# bash scripts/build_trees.sh --videos-dir <dir> # 全量
# bash scripts/build_trees.sh --videos-dir <dir> --limit 2 # 真实视频烟测
# VIDEO_CONCURRENCY=8 bash scripts/build_trees.sh --videos-dir <dir>
#
# 真实视频烟测流程(首次使用时执行):
# 1. --limit 2 建两个视频,观察日志速率与 API 并发
# 2. 中途 Ctrl+C 后重跑,确认已完成视频被跳过、未完成视频续跑
# 3. 检查 store/videos/<vid>/tree.json 可被 TreeIndex.load_json 加载
#
# 日志输出:
# stderr → 终端实时显示
# logs/build_trees.log → 完整日志(自动 rotation 50MB
# logs/build_trees_telemetry.db → LLM/VLM 调用遥测
# logs/build_progress.json → 断点续跑进度
#
# api_concurrency 走 .env 的 TREE_BUILD_API_CONCURRENCY(工程配置,默认 16
set -euo pipefail
cd "$(dirname "$0")/.."
VIDEO_CONCURRENCY="${VIDEO_CONCURRENCY:-16}"
export PYTHONUNBUFFERED=1
# shellcheck source=../.env
source .env
PYTHON="$(conda run -n Video-Tree-TRM which python)"
"${PYTHON}" tools/build_trees.py \
--out-dir store/videos \
--video-concurrency "$VIDEO_CONCURRENCY" \
"$@"