BM4b: the build modules keep an oversized end in steps-objects, read by the verb answer
The delivery SDK replaced the output chunks with the verb answer over the steps state's objects and output at form 2: each build module keeps an end over the steps state's value with KeepAnswerIn, serves AnswerTool and OutputTool over its steps state, and its steps name their outputs objects. Builds: design 47 H2 §791, H-A-412 addendum, H-A-412 second addendum (b), H-A-399 (1)
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
sdkstep "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep"
|
||||
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun"
|
||||
stdio "git.novox.be/novox/mesh-sdk/go"
|
||||
"git.novox.be/novox/mesh-sdk/go/busstate"
|
||||
)
|
||||
|
||||
// **The module pulls its seat's asks** (novox/hq ADR 0525 §2-§6, ADR 0536 §4; issue 1887 A3node), as mesh-build-go
|
||||
@@ -45,9 +46,19 @@ func (m *Module) askSteps(steps []StepTool) steprun.AskSteps {
|
||||
Lint: m.lintStep,
|
||||
Node: m.Node,
|
||||
SayStep: m.sayStep(),
|
||||
Outputs: m.outputs(),
|
||||
}
|
||||
}
|
||||
|
||||
// outputs are the outputs objects a test step keeps its run's output in and the verb output reads (design 47 H2 §791,
|
||||
// §820): Outputs when a test sets it, else the module's own objects store on the bus.
|
||||
func (m *Module) outputs() steprun.OutputObjects {
|
||||
if m.Outputs != nil {
|
||||
return m.Outputs
|
||||
}
|
||||
return busstate.ObjectsOf(steprun.OutputsStore)
|
||||
}
|
||||
|
||||
// sayStep says a pipeline step's end on this node's subject of the seat (design 47 G §24, *Asked on a work queue, ended by an
|
||||
// event*): SayStep when a test sets it, else the runtime's seat publish.
|
||||
func (m *Module) sayStep() func(sdkstep.StepEnded) error {
|
||||
@@ -89,7 +100,7 @@ func (m *Module) Puller(steps []StepTool, source steprun.AskSource) *steprun.Pul
|
||||
if m.SayEvent != nil {
|
||||
say = steprun.SayOn(sdkstep.AskNode, m.Node, m.SayEvent)
|
||||
}
|
||||
return &steprun.Puller{KeepOutput: steprun.KeepOutputIn(m.Outputs), Source: source, Language: sdkstep.AskNode, Say: say, Prior: steprun.PriorRuns(m.ReadSteps.Get), Node: m.Node, Put: m.Steps, PausePut: m.Pauses, Load: load, ForgetPause: m.ForgetPause, WatchPauses: m.WatchPauses, PauseKeys: m.ReadPauses.Keys,
|
||||
return &steprun.Puller{KeepAnswer: steprun.KeepAnswerIn(m.Answers), Source: source, Language: sdkstep.AskNode, Say: say, Prior: steprun.PriorRuns(m.ReadSteps.Get), Node: m.Node, Put: m.Steps, PausePut: m.Pauses, Load: load, ForgetPause: m.ForgetPause, WatchPauses: m.WatchPauses, PauseKeys: m.ReadPauses.Keys,
|
||||
Capacity: capacity, SettingsFile: settings, WatchConfig: watch, CoresPerStep: cores, BuildHours: hours, Logf: m.Say,
|
||||
Run: func(ctx context.Context, a sdkstep.StepAsk) (any, error) {
|
||||
if err := m.Prepare(ctx); err != nil {
|
||||
@@ -104,7 +115,8 @@ func (m *Module) Puller(steps []StepTool, source steprun.AskSource) *steprun.Pul
|
||||
|
||||
// SeatTools are the seat's verbs on this node (ADR 0525 §10).
|
||||
func (m *Module) SeatTools(p *steprun.Puller) []stdio.Tool {
|
||||
return append(steprun.SeatTools(Seat, "Node", p), m.stepsTool(), m.keptArtifactVerb(), steprun.OutputTool(Seat, steprun.ReadOutputFrom(m.Outputs)))
|
||||
return append(steprun.SeatTools(Seat, "Node", p), m.stepsTool(), m.keptArtifactVerb(), steprun.OutputTool(Seat, m.Node, m.outputs(), steprun.EndedHere(m.Node, m.ReadSteps.Keys, m.ReadSteps.Get)),
|
||||
steprun.AnswerTool(Seat, steprun.ReadAnswerFrom(m.Answers)))
|
||||
}
|
||||
|
||||
// StepEndTool ends one step left running (issue 1890); the module's steps state is the one it reads and writes.
|
||||
|
||||
@@ -79,7 +79,7 @@ func main() {
|
||||
logf("announcing the states it keeps: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
m.Outputs = busstate.ObjectsOf(steprun.OutputsStore)
|
||||
m.Answers = busstate.ObjectsOf(steprun.AnswersStore)
|
||||
steps := m.StepTools()
|
||||
booted := time.Now()
|
||||
puller := m.Puller(steps, nil)
|
||||
|
||||
@@ -118,7 +118,7 @@ func TestManifestKeepsItsStatesClaimsItsBuildSeatAndDeclaresItsHealthTool(t *tes
|
||||
if want := []string{"keys", "pauses", "toolchains"}; !slices.Equal(states, want) {
|
||||
t.Errorf("state = %v, want %v", states, want)
|
||||
}
|
||||
if len(m.Claims) != 1 || m.Claims[0].Name != Seat || !slices.Equal(m.Claims[0].Serves, []string{"current", "drop", "pause", "resume", "steps", "kept-artifact", "output"}) {
|
||||
if len(m.Claims) != 1 || m.Claims[0].Name != Seat || !slices.Equal(m.Claims[0].Serves, []string{"current", "drop", "pause", "resume", "steps", "kept-artifact", "output", "answer"}) {
|
||||
t.Errorf("claims = %v, want the seat %s alone", m.Claims, Seat)
|
||||
}
|
||||
if !slices.Contains(m.Tools, HealthTool) {
|
||||
|
||||
@@ -25,7 +25,11 @@ const CheckRound = 10 * time.Minute
|
||||
// Module is the Node build module's one running state: the node it runs on, its recipe, the toolchain guard, the
|
||||
// toolchain directory and the states it writes (toolchains, steps).
|
||||
type Module struct {
|
||||
// Outputs is the object store of a run's answers over what step-ended carries inline (steprun.OutputsStore); nil keeps none.
|
||||
// Answers is the steps state's objects (steprun.AnswersStore), where a step's end over what its key or step-ended
|
||||
// carries is kept and the seat's verb answer reads it (design 47 H2 H-A-412 addendum); nil keeps none.
|
||||
Answers steprun.OutputObjects
|
||||
// Outputs are the outputs objects (steprun.OutputsStore) a test step keeps a run's output in, which the verb output
|
||||
// reads (design 47 H2 §791); nil is the module's own on the bus (outputs), a test sets its own.
|
||||
Outputs steprun.OutputObjects
|
||||
// SayEvent publishes an event of the node build seat on a seat subject (stdio.SeatPublish; nil says none, a test's): the
|
||||
// puller's ask-taken, step-progress and step-ended (design 47 G §496, §602).
|
||||
|
||||
Reference in New Issue
Block a user