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.

Kept-worker event names the roles still held and why others were given back

Bowen Xuefa94af262bd5
diff --git a/freevideo_engine/comfy_nodes.py b/freevideo_engine/comfy_nodes.py
index 9b9b59d..9733125 100644
--- a/freevideo_engine/comfy_nodes.py
+++ b/freevideo_engine/comfy_nodes.py
@@ -427,7 +427,11 @@ class FreeVideoGenerate(io.ComfyNode):
gpu = comfy_bridge.installation()[1].get('gpu_uuid')
except (OSError, ValueError, KeyError, TypeError):
gpu = None
- kept = OWNER.finished(next_part=next_part, gpu=gpu, warm=True,
+ try:
+ admission = json.loads(output.with_suffix('.engine.json').read_text(encoding='utf-8')).get('resident_admission')
+ except (OSError, ValueError, AttributeError):
+ admission = None
+ kept = OWNER.finished(next_part=next_part, gpu=gpu, warm=True, decisions=admission,
agent=server is not None and str(getattr(server, 'client_id', '') or '').startswith('agent:'))
from .comfy_environment import executor_device
if target and not result_reused[0] and not executor_device():
diff --git a/freevideo_engine/resident_process.py b/freevideo_engine/resident_process.py
index 8337bdc..a6420fd 100644
--- a/freevideo_engine/resident_process.py
+++ b/freevideo_engine/resident_process.py
@@ -382,7 +382,7 @@ class SessionOwner:
rows, self.decisions = self.decisions, []
return rows
- def finished(self, *, next_part=None, agent=False, gpu=None, warm=False):
+ def finished(self, *, next_part=None, agent=False, gpu=None, warm=False, decisions=None):
"""Release the idle worker now, or keep it for the next request.
A successful request (warm) keeps its settled caches above HOST_FLOOR while the card's use can be read, so
@@ -413,7 +413,8 @@ class SessionOwner:
self.own = gpu_own(gpu) if warm else None
threading.Thread(target=self._watch, args=(self.generation, self.idle_since, hold, gpu),
name='freevideo-resident-hold', daemon=True).start()
- return self.record(action='kept', reason=next_part, seconds=hold, pid=self.process.pid)
+ return self.record(action='kept', reason=next_part, seconds=hold, pid=self.process.pid,
+ **(held_summary(decisions) if decisions else {}))
def _tight(self):
from .system import windows
@@ -613,6 +614,20 @@ class SessionOwner:
self.process = None
+def held_summary(decisions):
+ """Roles the worker still holds after a request and why others were given back (fields for the kept event)."""
+ held, evicted = {}, []
+ for row in decisions if isinstance(decisions, list) else []:
+ if not isinstance(row, dict) or not isinstance(row.get('role'), str):
+ continue
+ if row.get('action') in ('admit', 'park', 'reuse', 'unpark'):
+ held[row['role']] = True
+ elif row.get('action') == 'evict':
+ held.pop(row['role'], None)
+ evicted.append({'role': row['role'], 'reason': str(row.get('reason') or '')[:120]})
+ return {'held': sorted(held), 'evicted': evicted}
+
+
def gpu_used(gpu):
try:
from .background_room import Gpu