Repository navigation
docs(proposals): add build-parallel scheduling design proposal #1463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| # `build-parallel` scheduling: continuous queue, `--on-error`, concurrent-exclusive builds | ||
|
|
||
| - Author: Christian Heimes | ||
| - Created: 2026-11-09 | ||
| - Status: Proposed | ||
|
|
||
| ## What | ||
|
|
||
| Three independent improvements to how `fromager build-parallel` schedules builds: | ||
|
|
||
| 1. **Continuous queue.** Build packages as soon as they're ready, instead of waiting | ||
| for a whole group of packages to finish before starting the next group. | ||
| 2. **`--on-error {abort,continue}`.** Optionally keep building after a failure of a | ||
| non-build dependency, instead of always stopping the whole run. Failures are | ||
| reported together at the end, including a structured JSON report for tooling. | ||
| 3. **A middle ground for exclusive builds.** Today a package can only be "build this | ||
| completely alone" or not exclusive at all. Add a third option: "build at most one | ||
| of these at a time," which still lets ordinary packages build alongside it. | ||
|
|
||
| ## Why | ||
|
|
||
| The overall goal is to increase throughput and reduce total pipeline time for large | ||
| dependency graphs. | ||
|
|
||
| Today, `build-parallel` builds in groups: it starts every package that's currently | ||
| buildable, then waits for the entire group to finish before checking what else became | ||
| buildable. One slow package in a group holds up the start of unrelated, independent | ||
| work that's ready to go. | ||
|
|
||
| A failure stops new rounds, but submitted builds finish before the command exits. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Small thing, but this doesn’t quite match L77, which calls abort “immediately (identical to today’s behavior)”. Today we stop scheduling new rounds but still wait for everything already submitted. Under the new loop, what does abort actually do? Do we cancel futures that haven’t started and only wait for running ones? And do wheels that finish during that drain still show up in the summary? |
||
| That's the right call when the failed package is a build dependency of another | ||
| package: those dependents could never be built regardless. But plenty of failures | ||
| involve packages that aren't a build dependency of anything else, and aborting the | ||
| entire run for those throws away unrelated, otherwise buildable work. | ||
|
|
||
| Finally, today's "exclusive build" setting is all-or-nothing: a package either runs | ||
| completely alone, or runs with no isolation at all. Some packages are heavy or flaky | ||
| enough to want to avoid running alongside *each other*, without needing to block every | ||
| other package in the graph. | ||
|
|
||
| ## Goals | ||
|
|
||
| - Keep workers busy: start a package the moment it's buildable, not when its whole | ||
| batch is buildable. | ||
| - Let a build continue past a failure of a package that isn't a build dependency of | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I keep coming back to this one. Is aborting on a build-dependency failure a deliberate choice, or mostly an implementation shortcut? The topology already knows the reverse build closure, so we could mark the failed node’s dependents as skipped and keep going. That still satisfies “never attempt a build that’s already known to be impossible”. As written, one broken build backend (say setuptools-rust) stops the whole run, even if 95% of the graph is unrelated. Is there a reason pruning doesn’t work here? For example, do you see a build-dep failure as a sign that something systemic is wrong? |
||
| anything else, and finish everything unaffected by it, with all failures reported | ||
| together at the end. | ||
| - Keep aborting immediately whenever the failed package is a build dependency of | ||
| something else in the graph. Never attempt a build that's already known to be | ||
| impossible. | ||
| - Allow a package to require "only one of me at a time" without demanding full | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
These mean different things. We should clarify. Why the difference matters Say torch, vllm and jaxlib are all marked concurrent.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also Older fromager versions break. Today fromager only accepts true or false for exclusive_build. An older fromager that reads concurrent rejects the settings file with an error. |
||
| isolation from the rest of the build. | ||
| - Leave room to add more failure-handling behavior later without another breaking | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we might add a “skip dependents” mode later, would it be worth reserving that value now (e.g. --on-error {abort,continue,skip-dependents})? Otherwise continue might end up meaning something different from what people expect once a third mode exists. |
||
| change to the command-line interface. | ||
| - Give automation a machine-readable record of what failed and why, instead of only a | ||
| human-readable log. | ||
| - Keep the current error-handling and exclusivity defaults. Continuous scheduling | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I’m okay with continuous scheduling being the default. Did you consider whether anyone depends on the current round-based behavior, though? The round %i log lines go away and build order stops being deterministic between runs. Is leaving out an opt-out flag intentional? |
||
| applies to all runs. | ||
|
|
||
| ## Non-goals | ||
|
|
||
| - Changing the non-parallel, sequential build command. | ||
| - Changing or replacing the existing serial-bootstrap "continue past failures" mode. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does “keeping the two commands’ options consistent” look like in practice? Is the plan to add --on-error to bootstrap eventually and deprecate --test-mode? If so, it’d help to say so here. Also, test-mode currently exits with 1 on failures, while this proposal introduces distinct exit codes. Doesn’t that already make them inconsistent? |
||
| It's a separate feature (see [test-mode.md](test-mode.md)) that this proposal | ||
| doesn't touch, beyond keeping the two commands' options consistent. | ||
| - Automatically retrying failed builds. | ||
| - Changing how many builds can run at once (worker/concurrency limits are unaffected). | ||
|
|
||
| ## How | ||
|
|
||
| **Continuous queue**: the scheduler already supports being asked "what's ready?" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I traced this through I’m asking because
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Where should the "one at a time" check live: in the scheduler or in the build loop? |
||
| repeatedly. Ask again as soon as anything finishes. Track submitted nodes and | ||
| do not submit them again while their builds are queued or running. | ||
|
|
||
| **`--on-error continue`**: when a package fails, the command checks whether it's a | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How should a failed node be handled in the sorter? Right now build.py calls topo.done(node) in a finally, so it runs even on failure. With continuous dispatch, I think that could release the failed node’s dependents and get them submitted before the abort lands. Is the idea that a failed build dependency never gets marked done()? |
||
| build dependency of another package in the graph. If so, it aborts immediately | ||
| (identical to today's behavior, since those dependents could never succeed anyway). If | ||
| it isn't a build dependency of anything else, the failure is recorded instead, and the | ||
| rest of the (unrelated) build keeps going normally. | ||
|
|
||
| Once nothing more can be built, if any failures were recorded, the command logs them | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What’s the exact condition for “once nothing more can be built”? If a failed node is never marked done, is_active() stays true forever. I’m guessing it’s something like “nothing new available and nothing running”. It’d be good to spell that out so the loop can’t hang. |
||
| and exits with an error. It also writes them to a structured JSON report with a fixed | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why next to the graph file rather than in work_dir? Every other report we produce goes into work_dir (build-order.json, partial-failures.json, test-mode-failures-*.json). Also, GRAPH_FILE can be an HTTP(S) URL, and in some of our pipelines the graph lives on a read-only mount. Where does the report go in those cases? |
||
| name next to the dependency graph file, similar in spirit to the failure report | ||
|
tiran marked this conversation as resolved.
Resolved
|
||
| already produced by serial bootstrap's `--test-mode` (see | ||
| [test-mode.md](test-mode.md)), though that one uses a timestamped filename instead. | ||
| Aborting on a build-dependency failure and finishing with one or more independent | ||
| failures recorded are different outcomes, so they use different, specific non-zero | ||
| exit codes, letting a caller tell a hard abort apart from a best-effort run that | ||
| still recorded some (independent) failures. | ||
|
|
||
| "Build dependency" here includes more than direct build requirements: it also covers | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the part I’m most worried about. Say B is an install-only dependency of A and B fails under continue. A still builds and gets delivered, but nobody can install it. If downstream automation publishes “whatever built”, we’d ship a broken set without anyone noticing. Should each failure entry list the packages whose install closure is now broken? Or do you expect consumers to work that out from the graph themselves? |
||
| the install-time dependencies of a build requirement, i.e. whatever ends up installed | ||
| in the build environment. A package that's purely an install-time dependency of the | ||
| final shipped artifacts, and isn't needed to build anything else, is independent and | ||
| doesn't abort the run if it fails. A package that's an install-time dependency of a | ||
| build requirement is still part of that build dependency chain, so it does abort, | ||
| since something else's build genuinely needs it. | ||
|
|
||
| **Exclusive build, middle ground**: the existing per-package "build this alone" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When a concurrent package is running, does a full-exclusive package still wait for everything to drain, including the concurrent one? And the reverse: can a concurrent package start while a full-exclusive one is waiting to run? I’m wondering whether a steady stream of light builds could starve the exclusive one. |
||
| setting gains a second option meaning "build at most one of these at a time, but let | ||
| other, ordinary packages build alongside it." A package picks one of: no exclusivity, | ||
| full isolation, or this new shared-but-serialized mode. | ||
|
|
||
| ## Usage | ||
|
|
||
| ```bash | ||
| fromager build-parallel --on-error continue graph.json | ||
| # on failure, also writes build-parallel-failures.json next to graph.json | ||
| ``` | ||
|
|
||
| ```yaml | ||
| # package settings | ||
| build_options: | ||
| exclusive_build: concurrent | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How does this fit into the existing model? exclusive_build is a bool today, and PackageBuildInfo.exclusive_build returns bool, which hooks or plugins might already be calling. Would bool | "concurrent" work, or would an enum, or a separate field like exclusive_group: , be cleaner? A named group would also settle the “one of these vs one of me” question from L17. Also, concurrent reads to me like the opposite of what it does. Was that name a deliberate pick? |
||
| ``` | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick clarification: “at most one of these at a time” reads like a single global slot shared by every concurrent package. L51 says “only one of me at a time”, which sounds per-package. Which one did you mean? The per-package reading matters mostly for multi-version graphs, where two versions of the same package could otherwise build side by side.