Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
Make max_submit_count configurable via Config (#11673)
Kazuhisa Wada63f1dd78775e
diff --git a/api/.env.example b/api/.env.exampleindex 1ff6b3be8b8..74f83aa06c8 100644--- a/api/.env.example+++ b/api/.env.example@@ -433,3 +433,5 @@ RESET_PASSWORD_TOKEN_EXPIRY_MINUTES=5CREATE_TIDB_SERVICE_JOB_ENABLED=false+# Maximum number of submitted thread count in a ThreadPool for parallel node execution+MAX_SUBMIT_COUNT=100diff --git a/api/configs/feature/__init__.py b/api/configs/feature/__init__.pyindex f1cb3efda7b..e79401bdfda 100644--- a/api/configs/feature/__init__.py+++ b/api/configs/feature/__init__.py@@ -439,6 +439,17 @@ class WorkflowConfig(BaseSettings):)+class WorkflowNodeExecutionConfig(BaseSettings):+ """+ Configuration for workflow node execution+ """++ MAX_SUBMIT_COUNT: PositiveInt = Field(+ description="Maximum number of submitted thread count in a ThreadPool for parallel node execution",+ default=100,+ )++class AuthConfig(BaseSettings):"""Configuration for authentication and OAuth@@ -775,6 +786,7 @@ class FeatureConfig(ToolConfig,UpdateConfig,WorkflowConfig,+ WorkflowNodeExecutionConfig,WorkspaceConfig,LoginConfig,# hosted services configdiff --git a/api/core/workflow/graph_engine/graph_engine.py b/api/core/workflow/graph_engine/graph_engine.pyindex e03d4a7194a..034b4bd3992 100644--- a/api/core/workflow/graph_engine/graph_engine.py+++ b/api/core/workflow/graph_engine/graph_engine.py@@ -9,6 +9,7 @@ from typing import Any, Optional, castfrom flask import Flask, current_app+from configs import dify_configfrom core.app.apps.base_app_queue_manager import GenerateTaskStoppedErrorfrom core.app.entities.app_invoke_entities import InvokeFromfrom core.workflow.entities.node_entities import NodeRunMetadataKey, NodeRunResult@@ -52,7 +53,12 @@ logger = logging.getLogger(__name__)class GraphEngineThreadPool(ThreadPoolExecutor):def __init__(- self, max_workers=None, thread_name_prefix="", initializer=None, initargs=(), max_submit_count=100+ self,+ max_workers=None,+ thread_name_prefix="",+ initializer=None,+ initargs=(),+ max_submit_count=dify_config.MAX_SUBMIT_COUNT,) -> None:super().__init__(max_workers, thread_name_prefix, initializer, initargs)self.max_submit_count = max_submit_count@@ -92,7 +98,7 @@ class GraphEngine:max_execution_time: int,thread_pool_id: Optional[str] = None,) -> None:- thread_pool_max_submit_count = 100+ thread_pool_max_submit_count = dify_config.MAX_SUBMIT_COUNTthread_pool_max_workers = 10# init thread pooldiff --git a/api/core/workflow/nodes/iteration/iteration_node.py b/api/core/workflow/nodes/iteration/iteration_node.pyindex cbabe7a3c56..d935228c16a 100644--- a/api/core/workflow/nodes/iteration/iteration_node.py+++ b/api/core/workflow/nodes/iteration/iteration_node.py@@ -163,7 +163,9 @@ class IterationNode(BaseNode[IterationNodeData]):if self.node_data.is_parallel:futures: list[Future] = []q: Queue = Queue()- thread_pool = GraphEngineThreadPool(max_workers=self.node_data.parallel_nums, max_submit_count=100)+ thread_pool = GraphEngineThreadPool(+ max_workers=self.node_data.parallel_nums, max_submit_count=dify_config.MAX_SUBMIT_COUNT+ )for index, item in enumerate(iterator_list_value):future: Future = thread_pool.submit(self._run_single_iter_parallel,