From 2a448a899d1994cc2100bee2886114c4d6a6818b Mon Sep 17 00:00:00 2001 From: Novice <857526207@qq.com> Date: Tue, 3 Dec 2024 09:16:03 +0800 Subject: [PATCH] Fix: iteration not in main thread pool (#11271) Co-authored-by: Novice Lee --- api/core/workflow/nodes/iteration/iteration_node.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/core/workflow/nodes/iteration/iteration_node.py b/api/core/workflow/nodes/iteration/iteration_node.py index 22f242a42f..e32e58b780 100644 --- a/api/core/workflow/nodes/iteration/iteration_node.py +++ b/api/core/workflow/nodes/iteration/iteration_node.py @@ -116,7 +116,7 @@ class IterationNode(BaseNode[IterationNodeData]): variable_pool.add([self.node_id, "item"], iterator_list_value[0]) # init graph engine - from core.workflow.graph_engine.graph_engine import GraphEngine, GraphEngineThreadPool + from core.workflow.graph_engine.graph_engine import GraphEngine graph_engine = GraphEngine( tenant_id=self.tenant_id, @@ -162,7 +162,8 @@ class IterationNode(BaseNode[IterationNodeData]): if self.node_data.is_parallel: futures: list[Future] = [] q = Queue() - thread_pool = GraphEngineThreadPool(max_workers=self.node_data.parallel_nums, max_submit_count=100) + thread_pool = graph_engine.workflow_thread_pool_mapping[graph_engine.thread_pool_id] + thread_pool._max_workers = self.node_data.parallel_nums for index, item in enumerate(iterator_list_value): future: Future = thread_pool.submit( self._run_single_iter_parallel,