Skip to content

Commit ba0682d

Browse files
authored
Move cap_max_workers_in_pool to test/parallel_testsuite.py. NFC (#25196)
This is the only remaining caller.
1 parent 8764744 commit ba0682d

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

test/parallel_testsuite.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import common
1717
from common import errlog
1818

19-
from tools.shared import cap_max_workers_in_pool
2019
from tools.utils import WINDOWS
2120

2221

@@ -33,6 +32,17 @@ def python_multiprocessing_structures_are_buggy():
3332
return (v.major, v.minor, v.micro) <= (3, 12, 7) or (v.major, v.minor, v.micro) == (3, 13, 0)
3433

3534

35+
def cap_max_workers_in_pool(max_workers, is_browser):
36+
if is_browser:
37+
# TODO experiment with this number. In browser tests we'll be creating
38+
# a chrome instance per worker which is expensive.
39+
max_workers = int(max_workers / 2)
40+
# Python has an issue that it can only use max 61 cores on Windows: https://github.com/python/cpython/issues/89240
41+
if WINDOWS:
42+
return min(max_workers, 61)
43+
return max_workers
44+
45+
3646
def run_test(test, failfast_event, lock, progress_counter, num_tests):
3747
# If failfast mode is in effect and any of the tests have failed,
3848
# and then we should abort executing further tests immediately.

tools/shared.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,17 +128,6 @@ def returncode_to_str(code):
128128
return f'returned {code}'
129129

130130

131-
def cap_max_workers_in_pool(max_workers, is_browser):
132-
if is_browser:
133-
# TODO experiment with this number. In browser tests we'll be creating
134-
# a chrome instance per worker which is expensive.
135-
max_workers = int(max_workers / 2)
136-
# Python has an issue that it can only use max 61 cores on Windows: https://github.com/python/cpython/issues/89240
137-
if WINDOWS:
138-
return min(max_workers, 61)
139-
return max_workers
140-
141-
142131
def run_multiple_processes(commands,
143132
env=None,
144133
route_stdout_to_temp_files_suffix=None,

0 commit comments

Comments
 (0)