ctl restart --max-surge and --max-unavailable
A model's replicas restarted one at a time, always. RestartPace says how many restart at once: MaxSurge beside themselves (replacement first), MaxUnavailable stopped first (no room needed, out while loading); the reconciler begins that many per model per pass. The admin API takes max_surge and max_unavailable on POST /api/v1/restart. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
619dd751ab
commit
5ae870e1b2
6 files changed
+155
-18
No files matched your search
@@ -1517,6 +1517,11 @@ type RestartRequest struct {
|
||||
// InPlace stops each replica before starting its replacement, rather
|
||||
// than starting the replacement beside it first.
|
||||
InPlace bool `json:"in_place,omitempty"`
|
||||
// MaxSurge is how many of a model's replicas are replaced beside
|
||||
// themselves at once, MaxUnavailable how many are stopped first at once;
|
||||
// both zero is one at a time, replaced beside itself.
|
||||
MaxSurge int `json:"max_surge,omitempty"`
|
||||
MaxUnavailable int `json:"max_unavailable,omitempty"`
|
||||
}
|
||||
|
||||
// RestartResult lists the replicas queued.
|
||||
@@ -1540,11 +1545,12 @@ func (a *API) restart(w http.ResponseWriter, r *http.Request) {
|
||||
writeError(w, http.StatusBadRequest, "nothing ready matches; name replicas, models, or all")
|
||||
return
|
||||
}
|
||||
restart := a.ctl.Reconciler().Restart
|
||||
if req.InPlace {
|
||||
restart = a.ctl.Reconciler().RestartInPlace
|
||||
if req.MaxSurge < 0 || req.MaxUnavailable < 0 {
|
||||
writeError(w, http.StatusBadRequest, "max_surge and max_unavailable are counts of replicas, not negative")
|
||||
return
|
||||
}
|
||||
if err := restart(ids...); err != nil {
|
||||
pace := reconciler.RestartPace{MaxSurge: req.MaxSurge, MaxUnavailable: req.MaxUnavailable}
|
||||
if err := a.ctl.Reconciler().RestartPaced(pace, req.InPlace, ids...); err != nil {
|
||||
writeError(w, http.StatusNotFound, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user