From 3fa2f4ecaebd79abc8c08384b3201201bfe8de50 Mon Sep 17 00:00:00 2001 From: yuxuan-ms Date: Wed, 9 Oct 2024 14:28:12 +0800 Subject: [PATCH] Increase the number of Remote worker setup thread. --- doc/newsfragments/3060_changed.pool_size.rst | 1 + testplan/runners/pools/remote.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100755 doc/newsfragments/3060_changed.pool_size.rst diff --git a/doc/newsfragments/3060_changed.pool_size.rst b/doc/newsfragments/3060_changed.pool_size.rst new file mode 100755 index 000000000..3fda2d2db --- /dev/null +++ b/doc/newsfragments/3060_changed.pool_size.rst @@ -0,0 +1 @@ +Increase the number of Remote worker setup thread. \ No newline at end of file diff --git a/testplan/runners/pools/remote.py b/testplan/runners/pools/remote.py index f31cf5653..c492ac12d 100644 --- a/testplan/runners/pools/remote.py +++ b/testplan/runners/pools/remote.py @@ -3,6 +3,7 @@ import os import signal import socket +from multiprocessing import cpu_count from multiprocessing.pool import ThreadPool from typing import Callable, Dict, List, Optional, Tuple, Type, Union @@ -378,7 +379,7 @@ def _start_thread_pool(self) -> None: size = len(self._instances) try: if size > 2: - self.pool = ThreadPool(5 if size > 5 else size) + self.pool = ThreadPool(min(size, cpu_count())) except Exception as exc: if isinstance(exc, AttributeError): self.logger.warning(