Skip to content

Make videos on the computer you already own. FreeVideo runs MiniMax H3 in as little as 8 GB of VRAM and 16 GB of RAM, and adapts its acceleration path to your hardware.

Preload: take the staging-file cleanup back out

Bowen Xue89a5d2c676df
diff --git a/freevideo_engine/idle_encoder.py b/freevideo_engine/idle_encoder.py
index ccda294..f4c8b3f 100644
--- a/freevideo_engine/idle_encoder.py
+++ b/freevideo_engine/idle_encoder.py
@@ -5,7 +5,6 @@ CUDA, and a new foreground request cancels this lower-priority work first.
"""
import argparse
from contextlib import contextmanager
-import glob
import json
import os
import signal
@@ -118,20 +117,6 @@ def interruptible_load(patcher, check):
delattr(obj, name)
-def discard_staging(report):
- """Remove what a stopped preload left of an unfinished save.
-
- A worker that does not yield in time is stopped, sometimes between
- creating save()'s staging file and renaming it; the empty file would stay
- beside the user's video. Only this record's own staging names are removed.
- """
- for path in report.parent.glob(glob.escape(report.name) + '.*.tmp'):
- try:
- path.unlink()
- except OSError:
- pass
-
-
class IdleEncoder:
def __init__(self):
self.thread = None
@@ -220,8 +205,6 @@ class IdleEncoder:
if self.process is not None and self.process.poll() is None:
processes.stop(self.process, grace=1.)
save(report, dict(state='failed', reason=str(error), error_type=type(error).__name__))
- finally:
- discard_staging(report)
self.thread = threading.Thread(target=work, name='FreeVideo idle encoder', daemon=True)
self.thread.start()
diff --git a/freevideo_engine/resident_process.py b/freevideo_engine/resident_process.py
index 6284866..a16607c 100644
--- a/freevideo_engine/resident_process.py
+++ b/freevideo_engine/resident_process.py
@@ -403,10 +403,9 @@ class SessionOwner:
if self.prewarm is not None:
stopped = self.prewarm.stop()
from .encoder_diagnostics import prewarm_receipt
- from .idle_encoder import discard_staging
receipt = prewarm_receipt(self.prewarm.report, gpu=True)
receipt['worker_released'] = False
- report, self.prewarm = self.prewarm.report, None
+ self.prewarm = None
# An interrupted native loader can be stuck in IO. Never grant
# memory credit or start another request until it yielded/exited.
if self.process is not None and self.process.poll() is None:
@@ -418,9 +417,6 @@ class SessionOwner:
processes.stop(self.process, grace=1.)
self.process = None
receipt['worker_released'] = True
- # The worker writes the same record and may have been stopped inside that save.
- if report is not None:
- discard_staging(report)
return receipt
def warm_encoder(self, output, python, environment, *, busy=None, notify=None):