Skip to content

cmd: propagate a derived worker share to recursive subprocesses#2578

Draft
bendrucker wants to merge 1 commit into
fanout-boundfrom
recursive-propagation
Draft

cmd: propagate a derived worker share to recursive subprocesses#2578
bendrucker wants to merge 1 commit into
fanout-boundfrom
recursive-propagation

Conversation

@bendrucker

Copy link
Copy Markdown
Member

toWorkerCommands dropped --max-workers, so under --recursive each subprocess fell
back to the number of CPUs for its per-runner fan-out. Total in-flight work became
(directory workers) times NumCPU, which means the bound from #2577 did nothing in the
recursive case that motivated this whole effort.

This divides the worker budget across the directory workers that run concurrently and
passes that share to each subprocess as --max-workers. With a budget of N and N busy
directory workers, each subprocess runs its per-runner checks one at a time, so the
product stays at N. With fewer directories than the budget, each subprocess gets a larger
share. Directories times per-runner checks now stays within the budget in both plain and
recursive modes.

No user-facing flags change. --max-workers keeps its meaning and now bounds the
per-runner path under --recursive too. This is the gap the benchmark suite cannot reach
directly (it does not spawn subprocesses), so it is covered by unit tests for the share
math and the propagated command, plus the recursive integration suite.

Stacked on #2577.

toWorkerCommands dropped --max-workers, so under --recursive each subprocess fell back to NumCPU for its per-runner fan-out. Total in-flight work became (directory workers) times NumCPU, and the bound from the per-runner change did nothing in the recursive case that motivated it.

Divide the worker budget across the directory workers that run concurrently and pass that share to each subprocess as --max-workers. directories times per-runner checks now stays within the budget in both plain and recursive modes.

Claude-Session: https://claude.ai/code/session_01SFtKL5iaFWPVDqdcyvPiCJ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant