Say the try limits as what they are: a check when a try is asked
Tries let in while waiting may later all run at once; each node's build capacity bounds what runs on it (review of issue 1890's try cap).
This commit is contained in:
@@ -105,7 +105,7 @@ func TryTools(tr Trying) []stdio.Tool {
|
||||
{Name: check.TryTool,
|
||||
Description: "Try a pushed head before its pull request is opened: the checker judges it as it judges a pull request's head, merged onto its trunk's head, " +
|
||||
"its unit and integration levels through the build modules, and owes the forge nothing. Answers the try's id at once; " + check.TryReadTool + " reads " +
|
||||
"where it stands. A try of the same head that waits or runs is the answer to a second ask; at most 4 run on a build node and 8 wait for one at once, mesh-wide (a try queued behind the seat's checks holds no node). A repository " +
|
||||
"where it stands. A try of the same head that waits or runs is the answer to a second ask; a new try is refused while 4 tries run on a build node or 8 wait for one, mesh-wide; tries let in while waiting may later all run at once, and each node's build capacity bounds what runs on it. A repository " +
|
||||
"the checker checks no level of (one whose trunk the gate does not name) is refused. A try whose ask no build node took within the step " +
|
||||
"bound ends as error; its ask stays in the build seat's stream and may still run later, judged by nobody (issue 734).",
|
||||
Input: map[string]any{"type": "object", "required": []string{"repository", "head"}, "properties": map[string]any{
|
||||
|
||||
@@ -30,12 +30,12 @@ const (
|
||||
// TriesState is the checker's state of tries: the bucket mesh-delivery-checker_tries, keys try-<unix nanoseconds>.
|
||||
TriesState = "tries"
|
||||
TriesBucket = delivery.CheckerModule + "_" + TriesState
|
||||
// MaxTries is how many tries may hold a build node at once, mesh-wide: each holds one for minutes. A try whose asks no
|
||||
// node has taken yet waits behind the seat's other asks and holds none, so it counts toward MaxTriesWaiting instead
|
||||
// (issue 1890: at 19:53 on 2026-10-26 four tries sat queued behind 44 checks for up to 47 minutes and no fifth could be
|
||||
// asked).
|
||||
MaxTries = 4
|
||||
// MaxTriesWaiting is how many tries may wait at once, queued or with their asks not yet taken by a node.
|
||||
// MaxTries and MaxTriesWaiting are checked when a try is asked, mesh-wide: a new try is refused while MaxTries tries run
|
||||
// on a build node or MaxTriesWaiting wait for one (queued, or their asks not yet taken by a node). It is no bound on
|
||||
// what runs later: tries let in while waiting may later all run at once, and each node's build capacity bounds what
|
||||
// runs on it. A try waiting behind the seat's other asks holds no node, so it no longer blocks the next try (issue
|
||||
// 1890: at 19:53 on 2026-10-26 four tries sat queued behind 44 checks for up to 47 minutes and no fifth could be asked).
|
||||
MaxTries = 4
|
||||
MaxTriesWaiting = 8
|
||||
// TryScan is how many of the newest tries a new ask reads to find the ones that wait or run (issue 1827).
|
||||
TryScan = 64
|
||||
@@ -222,8 +222,8 @@ func NotChecked(repository string) error {
|
||||
}
|
||||
|
||||
// AskTry writes a new try, queued, and answers its id: a try of the same head that waits or runs is the answer to a second
|
||||
// ask, and at most MaxTries wait or run at once. trunks are the gate's trunk heads of every repository (source.main): a
|
||||
// repository with none is no repository the checker checks. A trunk asked by name is its trunk head now.
|
||||
// ask, and a new try is refused while MaxTries tries run on a build node or MaxTriesWaiting wait for one. trunks are the
|
||||
// gate's trunk heads of every repository (source.main): a repository with none is no repository the checker checks. A trunk asked by name is its trunk head now.
|
||||
func AskTry(store TryStore, trunks map[string]string, a TryAsk, now time.Time) (string, error) {
|
||||
repo := strings.ToLower(strings.TrimSuffix(strings.TrimSpace(a.Repository), ".git"))
|
||||
head := strings.ToLower(strings.TrimSpace(a.Head))
|
||||
@@ -301,10 +301,11 @@ func AskTry(store TryStore, trunks map[string]string, a TryAsk, now time.Time) (
|
||||
waiting = append(waiting, said)
|
||||
}
|
||||
}
|
||||
// Tries on a build node and tries waiting for one are bounded apart: a try queued behind the seat's checks holds no node.
|
||||
// Checked at this ask only: a try queued behind the seat's checks holds no node; tries let in while waiting may later
|
||||
// all run at once, and each node's build capacity bounds what runs on it.
|
||||
if len(holding) >= MaxTries || len(waiting) >= MaxTriesWaiting {
|
||||
return "", fmt.Errorf("%d tries run on a build node (the most at once: %d) and %d wait for one (the most: %d): running %s; waiting %s; ask again when one ends",
|
||||
len(holding), MaxTries, len(waiting), MaxTriesWaiting, orNone(holding), orNone(waiting))
|
||||
return "", fmt.Errorf("a new try is refused while %d tries run on a build node or %d wait for one; now %d run and %d wait: running %s; waiting %s; ask again when one ends",
|
||||
MaxTries, MaxTriesWaiting, len(holding), len(waiting), orNone(holding), orNone(waiting))
|
||||
}
|
||||
t.ID = "try-" + strconv.FormatInt(now.UnixNano(), 10)
|
||||
data, err := encodeTry(t)
|
||||
|
||||
@@ -84,8 +84,8 @@ func TestATryIsAskedQueuedOncePerHeadAndAtMostFourAtOnce(t *testing.T) { // ADR
|
||||
refused string
|
||||
}{
|
||||
{"four queued behind the checks, none on a node: a fifth is taken", 0, 4, ""},
|
||||
{"four on a node", MaxTries, 0, "4 tries run on a build node (the most at once: 4) and 0 wait"},
|
||||
{"three on a node, eight waiting", 3, MaxTriesWaiting, "3 tries run on a build node (the most at once: 4) and 8 wait for one (the most: 8)"},
|
||||
{"four on a node", MaxTries, 0, "now 4 run and 0 wait"},
|
||||
{"three on a node, eight waiting", 3, MaxTriesWaiting, "a new try is refused while 4 tries run on a build node or 8 wait for one; now 3 run and 8 wait"},
|
||||
} {
|
||||
kv := newMemKV()
|
||||
for i := range c.holding + c.wait {
|
||||
|
||||
Reference in New Issue
Block a user