feat(builder): opt-in parallel build pipeline (concurrency across envs)#10432
feat(builder): opt-in parallel build pipeline (concurrency across envs)#10432davidfirst wants to merge 2 commits into
Conversation
PR Summary by QodoOpt-in parallel build execution across envs with location barriers Description
Diagram
High-Level Assessment
Files changed (4)
|
Code Review by Qodo
1.
|
… on bit_pr The first cut ran each env as a sequential chain with only a barrier between location groups. That violated cross-env task dependencies: TesterTask declares `dependencies: [compiler]` with "complete for ALL envs" semantics, so tests must wait for every env's compile — but the chain model let env A's test start while env B was still compiling. Replace the scheduler with a readiness-based runner that blocks each entry on (a) its per-env predecessor (sequential within an env, preserves getBuildPipe order), (b) every env's instance of its declared dependency task types, and (c) the prior location group. Cross-env compilation itself is order-independent (the TS compiler resolves cross-component types from source), so envs still compile concurrently. Enable it on the bit_pr CI job via BIT_BUILD_CONCURRENCY=3 to measure in CircleCI. Default everywhere else stays serial (concurrency=1 → original mapSeries path).
|
Code review by qodo was updated up to the latest commit 60350a1 |
What
The build pipeline runs every task serially (
build-pipe.ts→mapSeries), using ~1 core to orchestrate on a multi-core machine. For a largebit ci prbuild (100 components, 5 envs) that's ~19m wall where tests are only ~3m — the rest is TS compile + preview webpack + schema, none overlapping.This adds an opt-in scheduler that runs environments concurrently. Default is unchanged (
concurrency = 1→ the originalmapSeriespath, byte-for-byte). Enable withBIT_BUILD_CONCURRENCY=<n>or thebuild.concurrencyconfig. It's turned on for thebit_prCI job (BIT_BUILD_CONCURRENCY=3) to measure in CircleCI.Correctness model (readiness-based scheduler)
Derived from the actual task model — most tasks don't declare
dependencies(they rely ongetBuildPipe()array order + the start/middle/end location mechanism); all envs share one capsule root; the TS compiler resolves cross-component types from source. The scheduler (tasks-parallel-scheduler.ts) blocks each task until:TesterTask.dependencies = [compiler]means tests wait for every env's compile;Only different envs run concurrently. Safe against the shared capsule root because every capsule file has a single writer env, and compile output is order-independent (source resolution).
Tests
tasks-parallel-scheduler.spec.ts(9 passing) covers: location split, blocker computation, every-entry-once, intra-env ordering, cross-env concurrency, the cross-env declared-dependency barrier (a tester waits for all envs' compile), the location barrier, and the concurrency bound.Notes
concurrency=3to start (memory: in-process webpack/tsc on the 2xlarge can OOM).core-aspect-envis the long pole, so 3 already captures most of the win; tune up once proven stable.