支持runninghub并发限制可配置

This commit is contained in:
puke
2025-12-28 14:56:22 +08:00
parent 5a2334ccde
commit 1530d1f8c8
7 changed files with 29 additions and 7 deletions

View File

@@ -130,6 +130,7 @@ class ConfigManager:
"comfyui_url": self.config.comfyui.comfyui_url,
"comfyui_api_key": self.config.comfyui.comfyui_api_key,
"runninghub_api_key": self.config.comfyui.runninghub_api_key,
"runninghub_concurrent_limit": self.config.comfyui.runninghub_concurrent_limit,
"tts": {
"default_workflow": self.config.comfyui.tts.default_workflow,
},
@@ -147,7 +148,8 @@ class ConfigManager:
self,
comfyui_url: Optional[str] = None,
comfyui_api_key: Optional[str] = None,
runninghub_api_key: Optional[str] = None
runninghub_api_key: Optional[str] = None,
runninghub_concurrent_limit: Optional[int] = None
):
"""Set ComfyUI global configuration"""
updates = {}
@@ -157,6 +159,8 @@ class ConfigManager:
updates["comfyui_api_key"] = comfyui_api_key
if runninghub_api_key is not None:
updates["runninghub_api_key"] = runninghub_api_key
if runninghub_concurrent_limit is not None:
updates["runninghub_concurrent_limit"] = runninghub_concurrent_limit
if updates:
self.update({"comfyui": updates})

View File

@@ -73,6 +73,7 @@ class ComfyUIConfig(BaseModel):
comfyui_url: str = Field(default="http://127.0.0.1:8188", description="ComfyUI Server URL")
comfyui_api_key: Optional[str] = Field(default=None, description="ComfyUI API Key (optional)")
runninghub_api_key: Optional[str] = Field(default=None, description="RunningHub API Key (optional)")
runninghub_concurrent_limit: int = Field(default=1, ge=1, le=10, description="RunningHub concurrent execution limit (1-10)")
tts: TTSSubConfig = Field(default_factory=TTSSubConfig, description="TTS-specific configuration")
image: ImageSubConfig = Field(default_factory=ImageSubConfig, description="Image-specific configuration")
video: VideoSubConfig = Field(default_factory=VideoSubConfig, description="Video-specific configuration")

View File

@@ -50,8 +50,6 @@ from pixelle_video.utils.prompt_helper import build_image_prompt
from pixelle_video.services.video import VideoService
# Parallel limit for RunningHub workflows (Call by sequential if set to 1)
RUNNING_HUB_PARALLEL_LIMIT = 1
class StandardPipeline(LinearVideoPipeline):
@@ -303,10 +301,13 @@ class StandardPipeline(LinearVideoPipeline):
(config.media_workflow and config.media_workflow.startswith("runninghub/"))
)
if is_runninghub and RUNNING_HUB_PARALLEL_LIMIT > 1:
logger.info(f"🚀 Using parallel processing for RunningHub workflows (max {RUNNING_HUB_PARALLEL_LIMIT} concurrent)")
# Get concurrent limit from config (default to 1 for backward compatibility)
runninghub_concurrent_limit = self.core.config.get("comfyui", {}).get("runninghub_concurrent_limit", 1)
if is_runninghub and runninghub_concurrent_limit > 1:
logger.info(f"🚀 Using parallel processing for RunningHub workflows (max {runninghub_concurrent_limit} concurrent)")
semaphore = asyncio.Semaphore(RUNNING_HUB_PARALLEL_LIMIT)
semaphore = asyncio.Semaphore(runninghub_concurrent_limit)
completed_count = 0
async def process_frame_with_semaphore(i: int, frame: StoryboardFrame):