ci.balance¶
Predict each check platform's wall at one to several shards; propose the counts.
Reads the metrics series the gate job writes; CI is its only
writer, a local run reads. Per platform, a runner and a Python,
the newest ten rows whose check jobs ran the full gate and
succeeded give the medians of four measures: F, the setup and
teardown the forge timed around the call; O, the summed wall of
the gate steps that are not test steps, which the first shard
alone runs; S, the summed test time over every package; and p,
the parallelism the test step reached, S over its wall. The
shards of a platform fold into one reading. The first shard's
slice is lighter by the tests O holds back, so the wall at n
shards is predicted as F + max(O, (S / p + O) / n) and the runner
seconds as about n F + S / p + O; the table prints
both for every count up to the cap, [ci] shards-max or
--max under it.
The proposal: the slowest platform, the largest wall at one
shard, takes the largest count whose every added shard saved at
least F; every other platform takes the smallest count whose
wall is within 15% of the slowest platform's, or the cap, named.
The pull request counts follow the same rule over
[ci] pull-request-runners when that list is shorter than
[ci] runners. The proposal prints as the TOML [ci] shards
and [ci] pull-request-shards would hold, with the predicted
wall of the slowest leg beside its wall at one shard. A platform
with fewer than three such rows keeps its count and is named. A
store that cannot be read prints why and proposes nothing.
Without a flag the verb changes nothing. --write rewrites the
two keys in the root workshop.toml when a count differs from
the contract's and the predicted wall at the proposed counts
differs from the wall at the contract's counts by more than 10%,
so a count does not move back and forth; every comment and every
other key stay, a count of one is left out of a table, a table
that would be empty is removed, and [ci] shards-max is read
and never written. It prints what each key becomes, or why nothing
was written: no platform with enough rows, no count changed, or a
wall that moved less. The workflows follow at the next fm sync,
which the last line says. --submit writes the same change on
the day's branch, chore/balance-<date>, renders the workflows,
commits it as chore(ci): the check legs run as <counts> and
submits it unarmed, for a person to merge; it runs from origin's
default branch alone and says so otherwise, and a day whose branch
origin already holds at these counts submits nothing and says so.
The nightly runs it once a day. A count can also be set by hand.
| Parameter | Type | Default | Description |
|---|---|---|---|
--max=INT |
int | 0 |
the largest shard count a platform may take; 0 reads [ci] shards-max, 4 when the contract is silent |
--write |
flag | false |
rewrite [ci] shards and [ci] pull-request-shards when due |
--submit |
flag | false |
write, commit on the day's branch and open its pull request, unarmed (implies --write) |