Skip to content

Commit cdfd9eb

Browse files
authored
Revert worker limits (#273)
black and gersemi 0.11.0 now limit their internal process pools to 60.
1 parent 6c93efd commit cdfd9eb

File tree

3 files changed

+7
-15
lines changed

3 files changed

+7
-15
lines changed

wpiformat/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ dynamic = [ "version" ]
55
readme = "README.rst"
66
dependencies = [
77
"regex==2023.10.3",
8-
"black==23.9.1",
8+
"black==24.2.0",
99
"clang-format==17.0.5",
1010
"clang-tidy==17.0.1",
11-
"gersemi==0.9.3"
11+
"gersemi==0.11.0"
1212
]
1313
classifiers = [
1414
"Development Status :: 5 - Production/Stable",

wpiformat/wpiformat/__init__.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,9 @@ def main():
324324
# on Windows. WaitForMultipleObjects() cannot wait on more then 64 events at
325325
# once, and mp uses a few internal events. Therefore, the maximum number of
326326
# parallel jobs is 60.
327-
cpu_count = min(60, mp.cpu_count())
327+
cpu_count = mp.cpu_count()
328+
if sys.platform == "win32":
329+
cpu_count = min(cpu_count, 60)
328330
parser.add_argument(
329331
"-j",
330332
dest="jobs",
@@ -531,12 +533,7 @@ def main():
531533
run_pipeline(task_pipeline, args, files)
532534

533535
# Lint is run last since previous tasks can affect its output.
534-
# CMakeFormat doesn't work on high core count machines.
535-
if mp.cpu_count() > 60:
536-
task_pipeline = [PyFormat(), Lint()]
537-
print("warning: Skipping CMake formatter due to too high CPU count.")
538-
else:
539-
task_pipeline = [CMakeFormat(), PyFormat(), Lint()]
536+
task_pipeline = [CMakeFormat(), PyFormat(), Lint()]
540537

541538
run_batch(task_pipeline, args, file_batches)
542539

wpiformat/wpiformat/pyformat.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""This task runs black on files with Python extension."""
22

3-
import multiprocessing as mp
43
import subprocess
54
import sys
65

@@ -15,11 +14,7 @@ def should_process_file(config_file, name):
1514
@staticmethod
1615
def run_batch(config_file, names):
1716
try:
18-
# Force at max 60 workers because black uses multiprocessing,
19-
# and we need to keep the total number of multiprocessing processes
20-
# below the Windows system limit.
21-
cpu_count = min(60, mp.cpu_count())
22-
args = [sys.executable, "-m", "black", "--workers", str(cpu_count), "-q"]
17+
args = [sys.executable, "-m", "black", "-q"]
2318
subprocess.run(args + names)
2419
except FileNotFoundError:
2520
print("Error: black not found in PATH. Is it installed?", file=sys.stderr)

0 commit comments

Comments
 (0)