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.

Keep a running chain block's report id and mark a restarted run's report as interrupted

Bowen Xue9045b9a2efb3
diff --git a/freevideo_engine/chain_runner.py b/freevideo_engine/chain_runner.py
index d492875..401ee78 100644
--- a/freevideo_engine/chain_runner.py
+++ b/freevideo_engine/chain_runner.py
@@ -5,6 +5,7 @@ import logging
import math
from pathlib import Path, PurePosixPath
import random
+import re
import threading
import time
import uuid
@@ -12,6 +13,8 @@ import uuid
from . import chain_leads, chain_plan
from . import chain_store as store
+REPORT_ID = re.compile(r'[a-f0-9]{32}')
+
def _split_value(record, text):
"""What the prompt model sorts into parts: the whole description and each part's new seconds."""
@@ -959,6 +962,12 @@ class ChainRunner:
block = self._current(record)
if block is None or block['state'] != 'running':
return None
+ token = message.get('report_id')
+ if isinstance(token, str) and REPORT_ID.fullmatch(token) and block['report_id'] != token:
+ # A restart ends this block before `finished` stores its report, and the
+ # report of the interrupted run is the one a failure needs.
+ block['report_id'] = record['last_report_id'] = token
+ self._save(record)
overall = message.get('overall') or {}
used = _number(overall.get('elapsed_seconds'))
used = self._elapsed(block) if used is None else used
diff --git a/freevideo_engine/comfy_progress.py b/freevideo_engine/comfy_progress.py
index d51268d..572be5c 100644
--- a/freevideo_engine/comfy_progress.py
+++ b/freevideo_engine/comfy_progress.py
@@ -236,6 +236,8 @@ class ReportDownloads:
return None
def snapshot(self, token):
+ with self.lock:
+ restarted = token not in self.runs
output = self._lookup(token)
if output is None:
raise KeyError('Unknown report')
@@ -244,7 +246,7 @@ class ReportDownloads:
target = output.with_suffix('.live.debug.json')
if is_link(output.parent) or target.is_symlink() or target.exists() and is_link(target):
raise KeyError('Report unavailable')
- path = write(output, live=True)
+ path = write(output, live=True, restarted=restarted)
if path is None:
raise RuntimeError('Report not available yet')
return path.read_bytes()
diff --git a/freevideo_engine/support_report.py b/freevideo_engine/support_report.py
index d9fa71b..6e44f2b 100644
--- a/freevideo_engine/support_report.py
+++ b/freevideo_engine/support_report.py
@@ -308,8 +308,11 @@ def write_encoder_retry(output, encoding, *, index):
return write(output, _retry=dict(stage='encoding', index=index, encoding=encoding))
-def write(output, report=None, bridge=None, *, _retry=None, live=False):
- """Bounded JSON/log reads only. Failure to write must not fail generation."""
+def write(output, report=None, bridge=None, *, _retry=None, live=False, restarted=False):
+ """Bounded JSON/log reads only. Failure to write must not fail generation.
+
+ restarted: a live report of a run that an earlier ComfyUI process started; nothing is still running it.
+ """
output = Path(output)
notes = []
def read_json(suffix, path=None):
@@ -454,7 +457,7 @@ def write(output, report=None, bridge=None, *, _retry=None, live=False):
if not request.get('encoding_resources'):
request['encoding_resources'] = dict(ram=read_json('.encoding.memory.json'))
summary = summarize(request, engine, encoding)
- if live and bridge.get('status') in ('starting', 'running'):
+ if live and not restarted and bridge.get('status') in ('starting', 'running'):
summary['status'] = 'running'
if bridge.get('status') == 'reused':
summary['status'] = 'reused'
@@ -535,6 +538,8 @@ def write(output, report=None, bridge=None, *, _retry=None, live=False):
payload = redactor.structured(payload)
if live:
payload['snapshot'] = dict(collected_at=time.time(), running=summary['status'] == 'running')
+ if restarted:
+ payload['snapshot']['restarted_since_run'] = True
# The generic secret redactor matches "token_summary" as a token key.
# Restore only its fixed numeric counts, never token IDs or text.
from .diagnostic_resources import token_summary