Skip to content

Commit

Permalink
Only set eligibility if the eval hasn't escaped
Browse files Browse the repository at this point in the history
  • Loading branch information
dadgar committed Feb 11, 2016
1 parent cc0ad87 commit 13d1fd0
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions scheduler/generic_sched.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,16 @@ func (s *GenericScheduler) Process(eval *structs.Evaluation) error {

// createBlockedEval creates a blocked eval and stores it.
func (s *GenericScheduler) createBlockedEval() error {
if s.eval == nil {
return fmt.Errorf("eval must be set to create blocked eval")
e := s.ctx.Eligibility()
escaped := e.HasEscaped()

// Only store the eligible classes if the eval hasn't escaped.
var classEligibility map[string]bool
if !escaped {
classEligibility = e.GetClasses()
}

e := s.ctx.Eligibility()
classes := e.GetClasses()
s.blocked = s.eval.BlockedEval(classes, e.HasEscaped())
s.blocked = s.eval.BlockedEval(classEligibility, escaped)
return s.planner.CreateEval(s.blocked)
}

Expand Down

0 comments on commit 13d1fd0

Please sign in to comment.