* feat: add Runpod serverless image collector pools * fix: prevent worker settings clipping and remove preview copy * fix: initialize worker settings before mounting the form * fix: validate complete serverless requests against 10 MB limit * fix: simplify serverless cards and keep status dots circular * fix: match serverless endpoint box to master card * fix: preserve serverless capacity and recovery across job failures Retain durable reservations until provider termination or explicit recovery, protect unresolved pools and credentials, and add scoped reconciliation. Consolidate lifecycle and secret policies and split prompt/media stages with regression coverage. * fix(serverless): disable Clear saved API key while the worker is enabled The checkbox read "Clear saved API key (disable pool first)", but the panel never defines "pool" and saving with it ticked on an enabled worker was rejected by the backend. - Disable the checkbox while the worker is enabled, with a tooltip saying to turn the worker off first. Also disable it when no key is saved. - Use "worker" instead of "pool" in user-facing serverless errors, the serverless guide and the README entry. * feat(serverless): replace Concurrent jobs with a single Images per run setting - Remove the separate Concurrent jobs field; rename Jobs per run to Images per run (1-16) with a tooltip explaining that Runpod's max workers decides how many GPUs run them. - Backend uses a fixed per-worker limit of 16 outstanding jobs, so all images of a run are submitted at once. Unresolved jobs still count against it. The limit is constant, so it never has to change while jobs are unresolved. - Legacy 'concurrency' in saved configs and older browser tabs is accepted and ignored/dropped; it no longer triggers the busy guard. - Revert the enable toggle and show the reason when the backend rejects it. - Trim a pasted api.runpod.ai/v2/<id> URL to the endpoint ID; plainer endpoint-ID error otherwise. - Confirm before a type change deletes a saved Runpod API key. - Update docs and tests.
52 lines
1.8 KiB
Python
52 lines
1.8 KiB
Python
from .process import ComfyRootDiscovery, LaunchCommandBuilder, ProcessLifecycle, ProcessPersistence
|
|
|
|
|
|
class WorkerProcessManager:
|
|
"""Thin composition wrapper around worker process subsystems."""
|
|
|
|
def __init__(self):
|
|
self.processes = {}
|
|
self._root_discovery = ComfyRootDiscovery()
|
|
self._launch_builder = LaunchCommandBuilder()
|
|
self._lifecycle = ProcessLifecycle(self)
|
|
self._persistence = ProcessPersistence(self)
|
|
self.load_processes()
|
|
|
|
def find_comfy_root(self):
|
|
return self._root_discovery.find_comfy_root()
|
|
|
|
def _find_windows_terminal(self):
|
|
return self._launch_builder._find_windows_terminal()
|
|
|
|
def build_launch_command(self, worker_config, comfy_root):
|
|
return self._launch_builder.build_launch_command(worker_config, comfy_root)
|
|
|
|
def launch_worker(self, worker_config, show_window=False):
|
|
if worker_config.get("type") == "serverless":
|
|
raise ValueError("Serverless pools cannot be launched as local processes")
|
|
return self._lifecycle.launch_worker(worker_config, show_window=show_window)
|
|
|
|
def stop_worker(self, worker_id):
|
|
return self._lifecycle.stop_worker(worker_id)
|
|
|
|
def get_managed_workers(self):
|
|
return self._lifecycle.get_managed_workers()
|
|
|
|
def cleanup_all(self):
|
|
return self._lifecycle.cleanup_all()
|
|
|
|
def load_processes(self):
|
|
return self._persistence.load_processes()
|
|
|
|
def save_processes(self):
|
|
return self._persistence.save_processes()
|
|
|
|
def _is_process_running(self, pid):
|
|
return self._lifecycle._is_process_running(pid)
|
|
|
|
def _check_worker_process(self, worker_id, proc_info):
|
|
return self._lifecycle._check_worker_process(worker_id, proc_info)
|
|
|
|
def _kill_process_tree(self, pid):
|
|
return self._lifecycle._kill_process_tree(pid)
|