# ๐ŸŒ™ Overnight Hash Pre-calculation Job Status **Job Started:** October 12, 2025 @ 05:19 AM **Status:** โœ… **RUNNING SUCCESSFULLY** **Expected Completion:** 15-30 hours (Oct 12 evening - Oct 13 morning) --- ## ๐Ÿ“Š Job Configuration - **Source Directory:** `/data/emu/source/myrient.erista.me/files` - **Total Archives:** 102,159 ZIP files (No-Intro + Redump) - **Parallel Workers:** 12 jobs - **Database:** `/data/emu/rom-farmer/metadata/database/romfarmer.db` - **Process:** Extract โ†’ Hash (CRC32, MD5, SHA1) โ†’ Store --- ## ๐Ÿ” Live Monitoring Commands ### Check if Job is Running ```bash ps aux | grep -E "precalculate-hashes|parallel" | grep -v grep ``` ### Watch Database Growth ```bash watch -n 10 'sqlite3 metadata/database/romfarmer.db "SELECT COUNT(*) as files, SUM(file_size)/1024.0/1024.0/1024.0 as GB FROM hash_cache;"' ``` ### Monitor Progress Log (Real-time) ```bash tail -f logs/hash-precalc/precalc_20251012_051956_progress.txt ``` ### Check Latest Processed Files ```bash tail -30 logs/hash-precalc/precalc_20251012_051956_progress.txt ``` ### View Error Log ```bash tail -50 logs/hash-precalc/precalc_20251012_051956_errors.log ``` ### Database Query Examples ```bash # Total cached files and size sqlite3 metadata/database/romfarmer.db "SELECT COUNT(*), SUM(file_size)/1024.0/1024.0/1024.0 as GB FROM hash_cache;" # Recent hashes sqlite3 metadata/database/romfarmer.db "SELECT file_path, crc32, md5, calculation_time FROM hash_cache ORDER BY created_at DESC LIMIT 10;" # Find specific game sqlite3 metadata/database/romfarmer.db "SELECT * FROM hash_cache WHERE file_path LIKE '%Mario%' LIMIT 5;" ``` --- ## ๐Ÿ“ Storage Format Files are stored with unique keys combining archive and inner file: ``` Format: /path/to/archive.zip::inner_file.rom Examples: - /data/emu/source/.../Mario.zip::Super Mario Bros (USA).nes - /data/emu/source/.../Zelda.zip::Legend of Zelda, The (USA).nes ``` This enables fast lookup without re-extraction! --- ## โœ… Verification - Job is Healthy! **Process Check (05:24 AM):** ``` aubrey 2945672 26.7 0.1 180328 174336 pts/14 S 05:18 1:28 /usr/bin/perl /usr/bin/parallel aubrey 3358426 30.6 0.1 180328 174592 pts/14 D 05:19 1:13 /usr/bin/perl /usr/bin/parallel ``` โœ… 2 parallel processes active, consuming 26-30% CPU each **Sample Output (05:24 AM):** ``` [2025-10-12 05:24:30] DONE: Super Robot Taisen J (Japan).gba (0s) - CRC32: c956fd37, MD5: ef32f93816b6dbcf788f08faf1e71450 [2025-10-12 05:24:30] DONE: Super Puzzle Fighter II (USA).gba (0s) - CRC32: 1201243a, MD5: f0de694021e61fbe5224d4a2e805e587 [2025-10-12 05:24:30] DONE: Super Street Fighter II Turbo - Revival (USA).gba (0s) - CRC32: 063045aa, MD5: 7a36a7486ef2c534111ee417b8acf9b7 ``` โœ… Hashes parsing correctly! **Database Status (05:24 AM):** ``` 3 files cached 0.41 GB processed ``` โœ… Database writes working! --- ## ๐Ÿ“ Log Files ### Main Logs (Current Run) - **Progress:** `logs/hash-precalc/precalc_20251012_051956_progress.txt` (5.7 MB and growing) - **Errors:** `logs/hash-precalc/precalc_20251012_051956_errors.log` - **Nohup:** `logs/hash-precalc/nohup_FINAL_20251012_051955.log` (21 MB and growing) - **Results:** `logs/hash-precalc/parallel_results_20251012_051956.txt` - **Stats JSON:** `logs/hash-precalc/precalc_20251012_051956_stats.json` (generated at completion) ### Previous Runs (for reference) - `logs/hash-precalc/precalc_20251012_051827_*` (earlier test run) --- ## ๐Ÿ› Known Issues (Non-Critical) ### Database Insert Errors Some entries show "Error: 1" in COMPLETE messages. This is due to SQL escaping issues with filenames containing special characters (apostrophes, quotes). These will need manual cleanup but don't affect the main hash calculation. **Example:** ``` COMPLETE: /data/emu/.../game.zip - Success: 1, Skip: 0, Error: 1 ``` **Fix for Tomorrow:** - Improve SQL quote escaping in script - Re-run with `--resume` to catch failed entries ### Performance Note Each file takes ~0-1s to process. At 12 parallel workers: - ~12 files/second = 43,200 files/hour - 102,159 files รท 43,200/hr = **~2.4 hours minimum** - With overhead (extraction, database writes): **10-15 hours realistic** --- ## ๐ŸŽฏ Expected Outcomes When the job completes, you'll have: 1. **Hash Cache Database** - ~102,000+ ROM files indexed - CRC32, MD5, SHA1 for each file - Fast lookup table (no re-extraction needed) 2. **Archive File Mapping** - Know exactly which ROM is in which ZIP - Query by hash to find source file - Enable ScreenScraper lookups without decompression 3. **Transformation Foundation** - Link source ROM hashes to compressed file hashes - Track ISO โ†’ CHD, NSP โ†’ NSZ, etc. - Build complete provenance chain 4. **DAT Integration Ready** - Cross-reference with No-Intro/Redump DATs - Verify collection completeness - Identify missing/incorrect files --- ## ๐Ÿ”ง If Job Stops ### Check Process ```bash ps aux | grep parallel ``` ### Restart with Resume ```bash cd /data/emu/rom-farmer nohup ./tools/precalculate-hashes.sh --jobs 12 --resume > logs/hash-precalc/nohup_resume_$(date +%Y%m%d_%H%M%S).log 2>&1 & ``` The `--resume` flag skips already-cached files, so you won't lose progress! ### Manual Stop (if needed) ```bash pkill -f "precalculate-hashes.sh" ``` --- ## ๐Ÿ“ˆ Progress Estimation To estimate completion: ```bash # Files processed so far CACHED=$(sqlite3 metadata/database/romfarmer.db "SELECT COUNT(*) FROM hash_cache;") # Total files TOTAL=102159 # Percentage echo "scale=2; $CACHED / $TOTAL * 100" | bc # Estimate time remaining (assumes 10k files/hour) REMAINING=$((TOTAL - CACHED)) HOURS=$(echo "scale=1; $REMAINING / 10000" | bc) echo "Estimated hours remaining: $HOURS" ``` --- ## ๐ŸŒ… Morning Checklist When you wake up: 1. **Check if job completed:** ```bash ps aux | grep parallel ``` 2. **View final stats:** ```bash cat logs/hash-precalc/precalc_20251012_051956_stats.json ``` 3. **Database statistics:** ```bash sqlite3 metadata/database/romfarmer.db <