M4 handover: coordinate fixes, detector registry, deploy v2, YOLOv8s, identity lifecycle
- Fix swift_pose/swift_ocr Y-flip bugs (BUG-003~006) - Add heuristic_scene module + post-processing trigger (replaces Places365) - YOLOv5nu → YOLOv8s CoreML (+33% detections, +390% scene indicators) - Per-table SQL export (split 4.7GB single file → 478MB max per table) - Version/build check in deploy.sh (compare /health vs file_info.json) - Add file_uuid column to identities table + backfill - Identity pre-clean step in deploy (avoids UNIQUE conflicts on re-deploy) - Stranger_xxx naming fix with UUID context - Add DETECTOR_REGISTRY.md (25 detectors), DETECTOR_SELECTION_SOP.md - Update SPATIAL_COORDINATE_REGISTRY.md (P layer, 6-layer architecture) - New IDENTITY_LIFECYCLE.md - M4 response docs for deploy_script_fix and 111614 test report
This commit is contained in:
@@ -15,10 +15,38 @@ echo "=== Momentry Package Deploy ==="
|
||||
echo "UUID: $UUID"
|
||||
echo "Time: $(date '+%Y-%m-%d %H:%M:%S')"
|
||||
echo ""
|
||||
echo "=== Momentry Package Deploy ==="
|
||||
echo "UUID: $UUID"
|
||||
echo "Time: $(date '+%Y-%m-%d %H:%M:%S')"
|
||||
echo ""
|
||||
|
||||
# 0. Version & build compatibility check
|
||||
echo "[0/8] Checking system version and build..."
|
||||
PKG_VER=$(python3 -c "import json; f=json.load(open('$DIR/file_info.json')); print(f.get('momentry_version','?'))")
|
||||
PKG_BUILD=$(python3 -c "import json; f=json.load(open('$DIR/file_info.json')); print(f.get('momentry_build','?'))")
|
||||
SRV=$(curl -sf http://localhost:3003/health | python3 -c "
|
||||
import json,sys
|
||||
d=json.load(sys.stdin)
|
||||
print(d.get('version','unknown'), d.get('build_git_hash','unknown'))
|
||||
" 2>/dev/null || echo "down down")
|
||||
SRV_VER=$(echo "$SRV" | cut -d' ' -f1)
|
||||
SRV_BUILD=$(echo "$SRV" | cut -d' ' -f2)
|
||||
if [ "$SRV_VER" = "down" ]; then
|
||||
echo " ⚠️ Cannot reach server at localhost:3003, skipping version check"
|
||||
elif [ "$SRV_VER" != "$PKG_VER" ] || [ "$SRV_BUILD" != "$PKG_BUILD" ]; then
|
||||
echo " ❌ Mismatch:"
|
||||
echo " Package Server"
|
||||
echo " Version: $PKG_VER $SRV_VER"
|
||||
echo " Build: $PKG_BUILD $SRV_BUILD"
|
||||
echo ""
|
||||
echo " Please obtain the matching system upgrade package."
|
||||
exit 1
|
||||
else
|
||||
echo " ✅ Server v$SRV_VER (build $SRV_BUILD) matches package"
|
||||
fi
|
||||
|
||||
# 1. Verify package integrity
|
||||
echo "[1/5] Verifying package..."
|
||||
REQUIRED_FILES=("data.sql" "file_info.json")
|
||||
echo "[1/8] Verifying package..."
|
||||
MISSING=0
|
||||
for f in "${REQUIRED_FILES[@]}"; do
|
||||
if [ ! -f "$DIR/$f" ]; then
|
||||
@@ -32,28 +60,38 @@ if [ $MISSING -eq 1 ]; then
|
||||
fi
|
||||
echo " ✅ Package verified"
|
||||
|
||||
# 2. Import data.sql
|
||||
echo "[2/5] Importing DB data..."
|
||||
"$PG_BIN/psql" -U "$DB_USER" -d "$DB_NAME" -f "$DIR/data.sql" 2>&1 | tail -3
|
||||
# 2. Pre-clean: remove existing identities for this file (avoids UNIQUE(name) conflicts on COPY)
|
||||
echo "[2/8] Pre-cleaning existing identities for this file..."
|
||||
"$PG_BIN/psql" -U "$DB_USER" -d "$DB_NAME" -c "DELETE FROM dev.identities WHERE file_uuid = '$UUID'" > /dev/null 2>&1
|
||||
echo " ✅ Cleared identities for $UUID"
|
||||
|
||||
# 3. Import data.sql (uses \i to load per-table files from sql/)
|
||||
echo "[3/8] Importing DB data..."
|
||||
(cd "$DIR" && "$PG_BIN/psql" -U "$DB_USER" -d "$DB_NAME" -f data.sql 2>&1) | tail -5
|
||||
echo " ✅ Data imported"
|
||||
|
||||
# 3. Copy video to demo dir
|
||||
# 4. Copy video to demo dir (only this package's video, not scanning others)
|
||||
VIDEO_FILE=$(ls "$DIR"/*.mp4 "$DIR"/*.mov "$DIR"/*.avi "$DIR"/*.mkv 2>/dev/null | head -1)
|
||||
if [ -n "$VIDEO_FILE" ]; then
|
||||
VIDEO_NAME=$(basename "$VIDEO_FILE")
|
||||
DEST="$DEMO_DIR/$VIDEO_NAME"
|
||||
if [ ! -f "$DEST" ]; then
|
||||
cp "$VIDEO_FILE" "$DEST"
|
||||
echo "[3/5] Video copied: $VIDEO_NAME → $DEMO_DIR"
|
||||
echo "[4/8] Video copied: $VIDEO_NAME → $DEMO_DIR"
|
||||
else
|
||||
echo "[3/5] Video already in demo dir, skipping"
|
||||
echo "[4/8] Video already in demo dir, skipping"
|
||||
fi
|
||||
else
|
||||
echo "[3/5] No video file in package, skipping"
|
||||
echo "[4/8] No video file in package, skipping"
|
||||
fi
|
||||
|
||||
# 4. Copy output files
|
||||
echo "[4/5] Copying output files..."
|
||||
# 5. Set video status to completed (package is fully processed)
|
||||
echo "[5/8] Setting deployment status..."
|
||||
"$PG_BIN/psql" -U "$DB_USER" -d "$DB_NAME" -c "UPDATE dev.videos SET status = 'completed' WHERE file_uuid = '$UUID'" > /dev/null 2>&1
|
||||
echo " ✅ Status set to 'completed'"
|
||||
|
||||
# 6. Copy output files
|
||||
echo "[6/8] Copying output files..."
|
||||
COPIED=0
|
||||
for f in "$DIR"/*.json "$DIR"/*.sqlite "$DIR"/*.sqlite; do
|
||||
if [ -f "$f" ]; then
|
||||
@@ -66,20 +104,25 @@ for f in "$DIR"/*.json "$DIR"/*.sqlite "$DIR"/*.sqlite; do
|
||||
done
|
||||
echo " ✅ $COPIED files copied to $OUTPUT_DIR"
|
||||
|
||||
# 5. Verify deployment
|
||||
echo "[5/5] Verifying deployment..."
|
||||
CHUNKS=$("$PG_BIN/psql" -U "$DB_USER" -d "$DB_NAME" -t -A -c "SELECT COUNT(*) FROM dev.chunk WHERE file_uuid='$UUID' AND chunk_type='sentence'" 2>/dev/null || echo "?")
|
||||
# 7. Verify deployment
|
||||
echo "[7/8] Verifying deployment..."
|
||||
CHUNKS=$("$PG_BIN/psql" -U "$DB_USER" -d "$DB_NAME" -t -A -c "SELECT COUNT(*) FROM dev.chunk WHERE file_uuid='$UUID'" 2>/dev/null || echo "?")
|
||||
FACES=$("$PG_BIN/psql" -U "$DB_USER" -d "$DB_NAME" -t -A -c "SELECT COUNT(*) FROM dev.face_detections WHERE file_uuid='$UUID'" 2>/dev/null || echo "?")
|
||||
IDENTS=$("$PG_BIN/psql" -U "$DB_USER" -d "$DB_NAME" -t -A -c "SELECT COUNT(*) FROM dev.identities WHERE file_uuid='$UUID'" 2>/dev/null || echo "?")
|
||||
TKG_NODES=$("$PG_BIN/psql" -U "$DB_USER" -d "$DB_NAME" -t -A -c "SELECT COUNT(*) FROM dev.tkg_nodes WHERE file_uuid='$UUID'" 2>/dev/null || echo "?")
|
||||
TKG_EDGES=$("$PG_BIN/psql" -U "$DB_USER" -d "$DB_NAME" -t -A -c "SELECT COUNT(*) FROM dev.tkg_edges WHERE file_uuid='$UUID'" 2>/dev/null || echo "?")
|
||||
|
||||
echo ""
|
||||
echo "=== Deploy Complete ==="
|
||||
echo " UUID: $UUID"
|
||||
echo " Chunks: $CHUNKS"
|
||||
echo " Faces: $FACES"
|
||||
echo " Output: $OUTPUT_DIR/"
|
||||
echo " UUID: $UUID"
|
||||
echo " Chunks: $CHUNKS"
|
||||
echo " Faces: $FACES"
|
||||
echo " Identities: $IDENTS"
|
||||
echo " TKG nodes: $TKG_NODES"
|
||||
echo " TKG edges: $TKG_EDGES"
|
||||
echo " Output: $OUTPUT_DIR/"
|
||||
echo ""
|
||||
echo "Next: trigger pipeline processing"
|
||||
echo " curl -X POST http://localhost:3003/api/v1/file/$UUID/process"
|
||||
echo "Package is self-contained — no further processing needed."
|
||||
echo ""
|
||||
echo "Or open the offline report:"
|
||||
echo " python3 render_offline_report.py $OUTPUT_DIR/$UUID.sqlite"
|
||||
echo "Offline report:"
|
||||
echo " python3 scripts/render_offline_report.py $OUTPUT_DIR/$UUID.sqlite"
|
||||
|
||||
Reference in New Issue
Block a user