scheduler: simplify eviction logic

This commit is contained in:
Armon Dadgar
2015-08-13 16:29:28 -07:00
parent 057d226d3f
commit eb408ddd39
2 changed files with 5 additions and 7 deletions

View File

@@ -739,11 +739,13 @@ func (e *Evaluation) ShouldEnqueue() bool {
func (e *Evaluation) MakePlan(j *Job) *Plan {
p := &Plan{
EvalID: e.ID,
Priority: j.Priority,
AllAtOnce: j.AllAtOnce,
Priority: e.Priority,
NodeEvict: make(map[string][]string),
NodeAllocation: make(map[string][]*Allocation),
}
if j != nil {
p.AllAtOnce = j.AllAtOnce
}
return p
}

View File

@@ -317,11 +317,7 @@ START:
}
// Create a plan to evict these
plan := &structs.Plan{
EvalID: eval.ID,
Priority: eval.Priority,
NodeEvict: make(map[string][]string),
}
plan := eval.MakePlan(nil)
// Add each alloc to be evicted
for _, alloc := range allocs {