Run the trail workers in a process pool so a worker that raises or dies fails the build, count the cores the process may use, and test both

This commit is contained in:
swaits committed 2026-11-20 16:35:19 -07:00
1 parent 5d86a42ad1
commit 3193a674d2
4 files changed
+73 -17

No files matched your search

+1 -1
View File
@@ -134,7 +134,7 @@ def warm(workers=None):
if "fork" not in multiprocessing.get_all_start_methods():
return
os.makedirs(SCANS, exist_ok=True)
count = workers or min(getattr(os, "process_cpu_count", os.cpu_count)() or 1, 8)
count = workers or min(len(os.sched_getaffinity(0)) if hasattr(os, "sched_getaffinity") else (os.cpu_count() or 1), 8)
with multiprocessing.get_context("fork").Pool(count) as pool:
for _ in pool.imap_unordered(_scan_one, keys, chunksize=8):
pass