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:
Alex Dadgar
2018-09-21 16:55:35 -07:00
parent 9d4ff89eaf
commit 82889c432e
3 changed files with 10 additions and 1 deletions

View File

@@ -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

View File

@@ -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)
}

View File

@@ -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()
}