diff --git a/scheduler/feasible.go b/scheduler/feasible.go index 6b137ab6c..37c066faa 100644 --- a/scheduler/feasible.go +++ b/scheduler/feasible.go @@ -219,11 +219,8 @@ func (iter *DynamicConstraintIterator) Next() *structs.Node { return option } - // In the case the job has a unique constraint it applies to all - // TaskGroups. - if iter.jobUnique && !iter.satisfiesUnique(option, true) { - continue - } else if iter.tgUnique && !iter.satisfiesUnique(option, false) { + if !iter.satisfiesUnique(option, iter.jobUnique) { + iter.ctx.Metrics().FilterNode(option, "unique") continue } @@ -252,9 +249,7 @@ func (iter *DynamicConstraintIterator) satisfiesUnique(option *structs.Node, job // a job and TaskGroup collision. jobInvalid := job && jobCollision tgInvalid := !job && jobCollision && taskCollision - if jobInvalid || tgInvalid { - iter.ctx.Metrics().FilterNode(option, "unique") return false } } diff --git a/scheduler/util_test.go b/scheduler/util_test.go index 417737dca..fc7263913 100644 --- a/scheduler/util_test.go +++ b/scheduler/util_test.go @@ -555,6 +555,7 @@ func TestInplaceUpdate_Success(t *testing.T) { updates := []allocTuple{{Alloc: alloc, TaskGroup: tg}} stack := NewGenericStack(false, ctx) + stack.SetJob(job) // Do the inplace update. unplaced := inplaceUpdate(ctx, eval, job, stack, updates)