mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 10:25:42 +03:00
Denormalize jobs in plan and ignore resources of terminal allocs
Denormalize jobs in AppendAllocs: AppendAlloc was originally only ever called for inplace upgrades and new allocations. Both these code paths would remove the job from the allocation. Now we use this to also add fields such as FollowupEvalID which did not normalize the job. This is only a performance enhancement. Ignore terminal allocs: Failed allocations are annotated with the followup Eval ID when one is created to replace the failed allocation. However, in the plan applier, when we check if allocations fit, these terminal allocations were not filtered. This could result in the plan being rejected if the node would be overcommited if the terminal allocations resources were considered.
This commit is contained in:
@@ -111,6 +111,11 @@ func AllocsFit(node *Node, allocs []*Allocation, netIdx *NetworkIndex) (bool, st
|
||||
|
||||
// For each alloc, add the resources
|
||||
for _, alloc := range allocs {
|
||||
// Do not consider the resource impact of terminal allocations
|
||||
if alloc.TerminalStatus() {
|
||||
continue
|
||||
}
|
||||
|
||||
if alloc.Resources != nil {
|
||||
if err := used.Add(alloc.Resources); err != nil {
|
||||
return false, "", nil, err
|
||||
|
||||
@@ -7138,6 +7138,10 @@ func (p *Plan) PopUpdate(alloc *Allocation) {
|
||||
func (p *Plan) AppendAlloc(alloc *Allocation) {
|
||||
node := alloc.NodeID
|
||||
existing := p.NodeAllocation[node]
|
||||
|
||||
// Normalize the job
|
||||
alloc.Job = nil
|
||||
|
||||
p.NodeAllocation[node] = append(existing, alloc)
|
||||
}
|
||||
|
||||
|
||||
@@ -326,7 +326,7 @@ SUBMIT:
|
||||
}
|
||||
return nil, nil, err
|
||||
} else {
|
||||
w.logger.Debug("submitted plan for evaluation", "plan_resp_index", resp.Index, "eval_id", plan.EvalID)
|
||||
w.logger.Debug("submitted plan for evaluation", "eval_id", plan.EvalID)
|
||||
w.backoffReset()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user