From 47412ca4b797bb336850044b7c41561c980d52f2 Mon Sep 17 00:00:00 2001 From: type-two Date: Wed, 26 Aug 2026 10:29:56 +1000 Subject: [PATCH] fix: sqlite WAL + busy timeout (concurrent farm index jobs), hatchling for -e installs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- bin/vg-find | 2 +- bin/vg-index | 3 ++- setup/setup_venvs.sh | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/vg-find b/bin/vg-find index b3663bb..894b60c 100755 --- a/bin/vg-find +++ b/bin/vg-find @@ -37,7 +37,7 @@ def main(): if not DB.exists(): sys.exit("no library yet — run vg-index first") - db = sqlite3.connect(DB) + db = sqlite3.connect(DB, timeout=30) if args.shots: rows = db.execute("""SELECT v.path, s.idx, s.start_s, s.end_s, s.thumb FROM shots s diff --git a/bin/vg-index b/bin/vg-index index 2ced750..1e321ce 100755 --- a/bin/vg-index +++ b/bin/vg-index @@ -35,7 +35,8 @@ def hb(msg, note=""): def open_db(): LIB.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(""" CREATE TABLE IF NOT EXISTS videos( id INTEGER PRIMARY KEY, path TEXT UNIQUE, mtime REAL, duration REAL, diff --git a/setup/setup_venvs.sh b/setup/setup_venvs.sh index 8af6bc2..d94365d 100755 --- a/setup/setup_venvs.sh +++ b/setup/setup_venvs.sh @@ -21,7 +21,7 @@ hb "2/10" "roto venv (py3.12)" RPY="$VG/venvs/roto/bin/python" 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" 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" fi 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 hb "6/10" "patch MatAnyone video reader (torchvision >= 0.23 removed read_video)"