assigner: rule 8 counts a healthy build that serves the verb whatever its phase says of the catalog
The pipeline runner's want on novox waited under rule 8 for seat:mesh-hand-acts.hand-act, which mesh-hand-acts serves on novox from a healthy build the catalog holds no entry of: its have stands in phase held (entry-missing), and rule 8 counted only phase running. A node that runs a healthy build of a part serves what that build serves, whatever its version and whether the catalog lists it: a healthy have held or waiting for a yes counts, unless its running statement says it stopped or is not healthy, and the rule says which build it counted. Builds: design 47 G A-426a, A-426, ADR 0614 §2
This commit is contained in:
@@ -1390,6 +1390,21 @@ func aWantWaitsOnTheVerbEdgesTheGraphKeeps(t *testing.T) {
|
||||
t.Errorf("served(%s) = %v, want %v: the running server's manifest serves w alone, late's is not read", v, served(v), want)
|
||||
}
|
||||
}
|
||||
// A-426a: a healthy build held (no catalog entry of it) or waiting for a yes serves what it serves, said once; one held unhealthy,
|
||||
// or whose running statement says it stopped, does not.
|
||||
held := at(fp("2"))
|
||||
held.Phase = nodeengineclient.PhaseHeld
|
||||
served = p.served(g, assign.Nodes{Haves: map[string]map[string]nodeengine.HaveByNodeModuleValue{"novox": {"late": held}}})
|
||||
if !served("late.t") {
|
||||
t.Error("a healthy held build of late does not serve late.t")
|
||||
}
|
||||
stopped := assign.Nodes{Haves: map[string]map[string]nodeengine.HaveByNodeModuleValue{"novox": {"late": held}},
|
||||
Running: map[string]map[string]nodeengine.Running{"novox": {"late": {Stopped: true}}}}
|
||||
sick := held
|
||||
sick.Health = "failed"
|
||||
if p.served(g, stopped)("late.t") || p.served(g, assign.Nodes{Haves: map[string]map[string]nodeengine.HaveByNodeModuleValue{"novox": {"late": sick}}})("late.t") {
|
||||
t.Error("a held build stopped, or not healthy, serves late.t")
|
||||
}
|
||||
// ADR 0614 §5: bus-state counts as offered only from a healthy build on a node present; the bus module's build on an
|
||||
// offline node offers nothing, and one whose manifest is not read counts its trunk manifest's offer. A-352: a have waiting
|
||||
// for a person's yes on a newer build names the build that still runs, healthy, and it offers bus-state too.
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"slices"
|
||||
|
||||
"git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient"
|
||||
"git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
|
||||
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
|
||||
|
||||
"git.novox.be/novox/mesh-sdk/go/catalogue"
|
||||
@@ -50,7 +51,7 @@ func (p *passer) served(g graph.Graph, n assign.Nodes) func(string) bool {
|
||||
if len(g) == 0 {
|
||||
return nil
|
||||
}
|
||||
served, unread := graph.Served(n.Haves, func(module, fp string) ([]string, bool) { return p.servesOf(module, fp) },
|
||||
served, unread := graph.Served(servingHaves(n, p.countedServing), func(module, fp string) ([]string, bool) { return p.servesOf(module, fp) },
|
||||
func(module string) []string { return g[module].Serves })
|
||||
if len(unread) > 0 {
|
||||
p.logf("the manifest of the running build of %v cannot be read, so what the module graph says they serve is counted as served", unread)
|
||||
@@ -108,3 +109,40 @@ func (p *passer) manifestOf(module, fp string) (catalogue.Manifest, bool) {
|
||||
}
|
||||
return got.manifest, true
|
||||
}
|
||||
|
||||
// servingHaves are the haves rule 8 counts (design 47 G A-426, A-426a): a node that runs a healthy build of a part serves what that
|
||||
// build serves, whatever its version and whether or not the catalog lists it, so a have held (its build has no catalog entry, a
|
||||
// put holds it) or waiting for a person's yes, whose build runs healthy, counts as running; a running statement that names a build
|
||||
// stopped, or not healthy, does not. counted is told each build so counted that its phase alone would have left out.
|
||||
func servingHaves(n assign.Nodes, counted func(node, module string, h nodeengine.HaveByNodeModuleValue)) map[string]map[string]nodeengine.HaveByNodeModuleValue {
|
||||
out := map[string]map[string]nodeengine.HaveByNodeModuleValue{}
|
||||
for node, haves := range n.Haves {
|
||||
out[node] = map[string]nodeengine.HaveByNodeModuleValue{}
|
||||
for module, h := range haves {
|
||||
if (h.Phase == nodeengineclient.PhaseHeld || h.Phase == nodeengineclient.PhaseWaitingYes) && h.Health == nodeengineclient.HealthOK {
|
||||
if r, ok := n.Running[node][module]; !ok || (!r.Stopped && (r.Healthy == nil || *r.Healthy)) {
|
||||
if counted != nil {
|
||||
counted(node, module, h)
|
||||
}
|
||||
h.Phase = nodeengineclient.PhaseRunning
|
||||
}
|
||||
}
|
||||
out[node][module] = h
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// countedServing says once per node, module and build that rule 8 counted a build whose have is not in phase running as serving
|
||||
// its verbs (A-426a): the rule says which build it counted.
|
||||
func (p *passer) countedServing(node, module string, h nodeengine.HaveByNodeModuleValue) {
|
||||
key := "serving " + node + "." + module + "@" + h.Fp + "." + h.Phase
|
||||
if p.skipped[key] {
|
||||
return
|
||||
}
|
||||
if p.skipped == nil {
|
||||
p.skipped = map[string]bool{}
|
||||
}
|
||||
p.skipped[key] = true
|
||||
p.logf("%s on %s runs %s healthy in phase %s: counted as serving what that build serves, whatever its version (design 47 G A-426a)", module, node, shortHex(h.Fp), h.Phase)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user