diff --git a/scripts/dispatcher.py b/scripts/dispatcher.py index c42e3c2..3a6d21d 100644 --- a/scripts/dispatcher.py +++ b/scripts/dispatcher.py @@ -225,7 +225,12 @@ def do_extract(job: sqlite3.Row, worker: dict) -> str: _, err, _ = ssh(worker["ssh_alias"], f"cat /tmp/cosma-ffmpeg-{job['id']}.log 2>/dev/null | tail -5 || echo ''") raise RuntimeError(f"ffmpeg failed on {v}: {err[:200]}") idx = count_frames(worker, frames_dir) + # Free MP4 cache immediately: thin pool on Proxmox host is tight and src_*.MP4 + # are 1-11 GB each. Frames are already extracted so worker_src is no longer needed. + ssh(worker["ssh_alias"], f"rm -f {shlex.quote(worker_src)}") set_status(job["id"], frame_count=idx, progress=min(99, idx * 100 // total_frames_est)) + # Trim once per job so LVM thin pool on the host actually reclaims the freed blocks. + ssh(worker["ssh_alias"], "sudo fstrim / 2>/dev/null || fstrim / 2>/dev/null", timeout=60) return frames_dir