From 658f0c98b050a30fe80a6bd8faad6f10fadd7019 Mon Sep 17 00:00:00 2001 From: LuLu Zuo Date: Thu, 7 Dec 2023 12:00:07 +0800 Subject: [PATCH] Refine if logic --- .../promptflow/executor/_line_execution_process_pool.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/promptflow/promptflow/executor/_line_execution_process_pool.py b/src/promptflow/promptflow/executor/_line_execution_process_pool.py index 6e3bd3b083b1..e7bc3fc140ed 100644 --- a/src/promptflow/promptflow/executor/_line_execution_process_pool.py +++ b/src/promptflow/promptflow/executor/_line_execution_process_pool.py @@ -406,12 +406,10 @@ def _generate_thread_status_messages(self, pool: ThreadPool, total_count: int): def _determine_worker_count(self): worker_count = get_int_env_var("PF_WORKER_COUNT") - estimated_available_worker_count = None - if not self._use_fork: - # Starting a new process in non-fork mode requires to allocate memory. Calculate the maximum number of - # processes based on available memory to avoid memory bursting. - estimated_available_worker_count = get_available_max_worker_count() + # Starting a new process in non-fork mode requires to allocate memory. Calculate the maximum number of processes + # based on available memory to avoid memory bursting. + estimated_available_worker_count = get_available_max_worker_count() if not self._use_fork else None # If the environment variable PF_WORKER_COUNT exists and valid, use the value as the worker_count. if worker_count is not None and worker_count > 0: