[object Object]

← back to Designer Wallcoverings

Multi-book local-room queue: prep swatches + sequential render

e194baa0e9c2e7ee9d4426d1d38c56df86177340 · 2026-07-07 08:42:00 -0700 · Steve

- prep_book_swatches_example.py: download swatches from image_url + backfill
  local_image_path for any WallQuest catalog (Daisy Bennett: 62/63 done)
- queue_book_example.sh: wait for prior book's GPU batch, then render next book
  (Kontext-only winner) + backfill room_setting_images. Sequential = no GPU thrash.

Rolls $0 local rooms across all safe LLM builds (Carl Robinson running, Daisy
Bennett queued). phillipe_romano stays sibling-owned/untouched.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit e194baa0e9c2e7ee9d4426d1d38c56df86177340
Author: Steve <steve@designerwallcoverings.com>
Date:   Tue Jul 7 08:42:00 2026 -0700

    Multi-book local-room queue: prep swatches + sequential render
    
    - prep_book_swatches_example.py: download swatches from image_url + backfill
      local_image_path for any WallQuest catalog (Daisy Bennett: 62/63 done)
    - queue_book_example.sh: wait for prior book's GPU batch, then render next book
      (Kontext-only winner) + backfill room_setting_images. Sequential = no GPU thrash.
    
    Rolls $0 local rooms across all safe LLM builds (Carl Robinson running, Daisy
    Bennett queued). phillipe_romano stays sibling-owned/untouched.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
 .../prep_book_swatches_example.py                  | 32 +++++++++++++++++
 .../room-engines-generic/queue_book_example.sh     | 41 ++++++++++++++++++++++
 2 files changed, 73 insertions(+)

diff --git a/scripts/wallquest-refresh/room-engines-generic/prep_book_swatches_example.py b/scripts/wallquest-refresh/room-engines-generic/prep_book_swatches_example.py
new file mode 100644
index 00000000..163939d6
--- /dev/null
+++ b/scripts/wallquest-refresh/room-engines-generic/prep_book_swatches_example.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python3
+# GPU-free prep for Daisy Bennett local rooms: download each swatch from image_url,
+# save as img/{dw_sku}.jpg in a viewer dir, backfill local_image_path. Additive only.
+import os, subprocess, urllib.request, json
+CONN = 'postgresql://dw_admin@127.0.0.1:5432/dw_unified'
+VIEW = '/Users/macstudio3/Projects/Designer-Wallcoverings/scripts/wallquest-refresh/daisy-bennett-viewer'
+IMG = f'{VIEW}/img'; os.makedirs(IMG, exist_ok=True)
+def psql(sql): return subprocess.run(['psql', CONN, '-tAc', sql], capture_output=True, text=True).stdout.strip()
+
+rows = [l.split('|') for l in psql("SELECT dw_sku, COALESCE(image_url,'') FROM daisy_bennett_catalog ORDER BY dw_sku").splitlines() if l]
+ok = skip = bad = 0; sqls = []
+for sku, url in rows:
+    if not url or 'default-image' in url:
+        bad += 1; print(f'skip {sku}: no usable image_url'); continue
+    ext = '.jpg'
+    dest = f'{IMG}/{sku}{ext}'
+    rel = f'img/{sku}{ext}'
+    if not os.path.exists(dest):
+        try:
+            req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0', 'Referer': 'https://www.wallquest.com/'})
+            data = urllib.request.urlopen(req, timeout=30).read()
+            if len(data) < 2000: bad += 1; print(f'bad {sku}: tiny ({len(data)}b)'); continue
+            open(dest, 'wb').write(data); ok += 1
+        except Exception as e:
+            bad += 1; print(f'ERR {sku}: {str(e)[:60]}'); continue
+    else:
+        skip += 1
+    sqls.append(f"UPDATE daisy_bennett_catalog SET local_image_path='{json.dumps([rel])}'::jsonb WHERE dw_sku='{sku}';")
+if sqls:
+    open('/tmp/_daisy_lip.sql', 'w').write('\n'.join(sqls))
+    subprocess.run(['psql', CONN, '-q', '-f', '/tmp/_daisy_lip.sql'])
+print(f'\nDAISY PREP: downloaded={ok} already={skip} bad/skipped={bad} -> {IMG}; local_image_path backfilled for {len(sqls)}')
diff --git a/scripts/wallquest-refresh/room-engines-generic/queue_book_example.sh b/scripts/wallquest-refresh/room-engines-generic/queue_book_example.sh
new file mode 100644
index 00000000..9d5e3c81
--- /dev/null
+++ b/scripts/wallquest-refresh/room-engines-generic/queue_book_example.sh
@@ -0,0 +1,41 @@
+#!/bin/zsh
+# Book render QUEUE: wait for Carl Robinson's Kontext batch to finish, THEN render
+# Daisy Bennett locally (Kontext only — the bake-off winner). Sequential = no GPU
+# thrash. $0 local. Additive: backfills Daisy room_setting_images with the local rooms.
+set -u
+CARL_OUT=/Users/macstudio3/Projects/Designer-Wallcoverings/scripts/wallquest-refresh/carl-robinson-viewer/rooms-local
+GEN=/Users/macstudio3/Projects/Designer-Wallcoverings/scripts/wallquest-refresh/room-engines-generic
+DVIEW=/Users/macstudio3/Projects/Designer-Wallcoverings/scripts/wallquest-refresh/daisy-bennett-viewer
+ASSETS=/Users/macstudio3/Projects/Designer-Wallcoverings/scripts/wallquest-refresh/carl-robinson-viewer/bakeoff-assets
+CONN=postgresql://dw_admin@127.0.0.1:5432/dw_unified
+LOG=/tmp/queue_daisy.log
+echo "$(date +%H:%M) queue start; waiting for Carl Robinson kontext to finish…" > $LOG
+
+# 1) wait until Carl Robinson kontext batch is done (67/67) or its proc exits
+while :; do
+  k=$(ls "$CARL_OUT"/*-kontext.png 2>/dev/null | wc -l | tr -d ' ')
+  pgrep -f batch_kontext.sh >/dev/null || { echo "$(date +%H:%M) carl kontext proc gone (k=$k)" >> $LOG; break; }
+  [ "$k" -ge 67 ] && { echo "$(date +%H:%M) carl kontext 67/67" >> $LOG; break; }
+  sleep 120
+done
+sleep 20
+
+# 2) render Daisy Bennett (kontext) via the generic pipeline
+echo "$(date +%H:%M) rendering Daisy Bennett (kontext)…" >> $LOG
+mkdir -p "$DVIEW/rooms-local"
+printf 'img/\nrooms-local/\n' > "$DVIEW/.gitignore"
+CATALOG=daisy_bennett_catalog VIEW="$DVIEW" OUTDIR="$DVIEW/rooms-local" \
+  BASE_ROOM="$ASSETS/empty-room.png" WALL_MASK="$ASSETS/wall-mask.png" ENGINES="kontext" \
+  zsh "$GEN/render_book.sh" >> $LOG 2>&1
+
+# 3) wait for Daisy kontext batch to drain, then backfill room_setting_images
+sleep 30
+while pgrep -f "OUTDIR=$DVIEW" >/dev/null 2>&1 || pgrep -f batch_kontext.sh >/dev/null; do sleep 120; done
+echo "$(date +%H:%M) Daisy render done; backfilling room_setting_images…" >> $LOG
+for f in "$DVIEW"/rooms-local/*-kontext.png; do
+  [ -e "$f" ] || continue
+  sku=$(basename "$f" | sed 's/-kontext.png//')
+  psql "$CONN" -q -c "UPDATE daisy_bennett_catalog SET room_setting_images='[\"rooms-local/$(basename "$f")\"]'::jsonb WHERE dw_sku='$sku';"
+done
+n=$(ls "$DVIEW"/rooms-local/*-kontext.png 2>/dev/null | wc -l | tr -d ' ')
+echo "$(date +%H:%M) DAISY COMPLETE: $n kontext rooms; room_setting_images backfilled" >> $LOG

← 16b10021 Reusable local room-render pipeline (any DW catalog)  ·  back to Designer Wallcoverings  ·  auto-save: 2026-07-07T08:56:34 (10 files) — DW-Programming/I 10cc4fda →