fix: sqlite WAL + busy timeout (concurrent farm index jobs), hatchling for -e installs

Two concurrent vidgod_index jobs on one node hit "database is locked" —
vg-index now opens the library in WAL mode with a 60s busy timeout (vg-find
30s). setup_venvs.sh installs hatchling+editables and does the MatAnyone -e
with --no-deps (its pyproject drags in cchardet, dead on py3.12).
Found during the m4probook standup + farm spill test.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
type-two 2026-08-26 10:29:56 +10:00
parent 8c84243b61
commit 47412ca4b7
3 changed files with 5 additions and 4 deletions

View File

@ -37,7 +37,7 @@ def main():
if not DB.exists(): if not DB.exists():
sys.exit("no library yet — run vg-index first") sys.exit("no library yet — run vg-index first")
db = sqlite3.connect(DB) db = sqlite3.connect(DB, timeout=30)
if args.shots: if args.shots:
rows = db.execute("""SELECT v.path, s.idx, s.start_s, s.end_s, s.thumb FROM shots s rows = db.execute("""SELECT v.path, s.idx, s.start_s, s.end_s, s.thumb FROM shots s

View File

@ -35,7 +35,8 @@ def hb(msg, note=""):
def open_db(): def open_db():
LIB.mkdir(parents=True, exist_ok=True) LIB.mkdir(parents=True, exist_ok=True)
THUMBS.mkdir(parents=True, exist_ok=True) THUMBS.mkdir(parents=True, exist_ok=True)
db = sqlite3.connect(DB) db = sqlite3.connect(DB, timeout=60)
db.execute("PRAGMA journal_mode=WAL") # concurrent index jobs on one node
db.executescript(""" db.executescript("""
CREATE TABLE IF NOT EXISTS videos( CREATE TABLE IF NOT EXISTS videos(
id INTEGER PRIMARY KEY, path TEXT UNIQUE, mtime REAL, duration REAL, id INTEGER PRIMARY KEY, path TEXT UNIQUE, mtime REAL, duration REAL,

View File

@ -21,7 +21,7 @@ hb "2/10" "roto venv (py3.12)"
RPY="$VG/venvs/roto/bin/python" RPY="$VG/venvs/roto/bin/python"
hb "3/10" "torch+torchvision into roto (big download)" hb "3/10" "torch+torchvision into roto (big download)"
uv pip install --python "$RPY" torch torchvision numpy opencv-python pillow tqdm huggingface_hub imageio imageio-ffmpeg || die "torch install" uv pip install --python "$RPY" torch torchvision numpy opencv-python pillow tqdm huggingface_hub imageio imageio-ffmpeg hatchling editables || die "torch install"
hb "4/10" "clone + install SAM2" hb "4/10" "clone + install SAM2"
if [ ! -d "$VG/tools/sam2" ]; then if [ ! -d "$VG/tools/sam2" ]; then
@ -37,7 +37,7 @@ if [ -f "$VG/tools/MatAnyone/requirements.txt" ]; then
uv pip install --python "$RPY" -r "$VG/tools/MatAnyone/requirements.txt" || echo "WARN: some MatAnyone reqs failed, continuing" uv pip install --python "$RPY" -r "$VG/tools/MatAnyone/requirements.txt" || echo "WARN: some MatAnyone reqs failed, continuing"
fi fi
if [ -f "$VG/tools/MatAnyone/pyproject.toml" ] || [ -f "$VG/tools/MatAnyone/setup.py" ]; then if [ -f "$VG/tools/MatAnyone/pyproject.toml" ] || [ -f "$VG/tools/MatAnyone/setup.py" ]; then
uv pip install --python "$RPY" --no-build-isolation -e "$VG/tools/MatAnyone" || echo "WARN: matanyone -e install failed (will use sys.path)" uv pip install --python "$RPY" --no-deps --no-build-isolation -e "$VG/tools/MatAnyone" || echo "WARN: matanyone -e install failed (will use sys.path)"
fi fi
hb "6/10" "patch MatAnyone video reader (torchvision >= 0.23 removed read_video)" hb "6/10" "patch MatAnyone video reader (torchvision >= 0.23 removed read_video)"