Skip to content

Commit ebd6b99

Browse files
[update-checkout] limit the number of processes on Python < 3.10
1 parent dd8b028 commit ebd6b99

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

utils/update_checkout/update_checkout/parallel_runner.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,13 @@ def __init__(
4848
):
4949
self._monitor_polling_period = 0.1
5050
if n_processes == 0:
51-
n_processes = cpu_count() * 2
51+
if sys.version_info.minor < 10:
52+
# On Python < 3.10, https://bugs.python.org/issue46391 causes
53+
# Pool.map and its variants to hang. Limiting the number of
54+
# processes fixes the issue.
55+
n_processes = int(cpu_count() * 1.25)
56+
else:
57+
n_processes = cpu_count() * 2
5258
self._terminal_width = shutil.get_terminal_size().columns
5359
self._n_processes = n_processes
5460
self._pool_args = pool_args

0 commit comments

Comments
 (0)