Carry a process's drain bound in the declaration

A process that stays up may name drain-bound (seconds): the node-engine
writes its unit's stop from it, so the tool runner finishes its calls in
flight before it exits. Absent is none; a step or a scheduled run is
refused one.

Builds: design 47 H2 §813 (12); H-A-358, H-A-353
This commit is contained in:
2026-11-21 23:08:38 +01:00
parent f5dc3b6bd1
commit d40fa0b3a0
2 changed files with 28 additions and 0 deletions
+12
View File
@@ -921,6 +921,11 @@ type Process struct {
// runtime of a build seat's holder, whose builds must never slow the operator's desktop. Absent: the machine's
// defaults. For a process that stays up.
Yields *Yields `json:"yields,omitempty"`
// DrainBound is how long, in seconds, the process finishes the calls in flight once stopped before it exits
// (design 47 H2 §813 (12); H-A-358): the node-engine writes the unit's stop so the stop signal reaches this process
// alone and waits that long and the time its children take. Absent: none. For a process that stays up.
DrainBound int `json:"drain-bound,omitempty"`
}
// YieldIdle is the one priority a process yields at: the lowest there is.
@@ -1024,6 +1029,13 @@ func (d *Process) validate(where string, _ bool) []string {
problems = append(problems, where+": a witness judges a process that stays up; a step or a "+
"scheduled run is not running between its runs")
}
if d.DrainBound < 0 {
problems = append(problems, fmt.Sprintf("%s: drain-bound is %d: a bound is seconds, none or more", where, d.DrainBound))
}
if d.DrainBound > 0 && (d.RunOnce || d.Schedule != "") {
problems = append(problems, where+": drain-bound is for a process that stays up; a step or a scheduled run "+
"is not stopped while it serves calls")
}
if strings.ContainsAny(d.NotReversible, "\n\r") {
problems = append(problems, where+": not-reversible is one line")
}