From 34a66835db20eea7d5558c340f3f7b7a0d2b6ca7 Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Thu, 13 Jun 2019 09:37:18 -0400 Subject: [PATCH] Don't stop rescheduleLater allocations When an alloc is due to be rescheduleLater, it goes through the reconciler twice: once to be ignored with a follow up evals, and once again when processing the follow up eval where they appear as rescheduleNow. Here, we ignore them in the first run and mark them as stopped in second iteration; rather than stop them twice. --- scheduler/reconcile.go | 6 ------ scheduler/reconcile_test.go | 12 ++++++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/scheduler/reconcile.go b/scheduler/reconcile.go index 6e069224d..d3f20fe81 100644 --- a/scheduler/reconcile.go +++ b/scheduler/reconcile.go @@ -356,7 +356,6 @@ func (a *allocReconciler) computeGroup(group string, all allocSet) bool { // Create batched follow up evaluations for allocations that are // reschedulable later and mark the allocations for in place updating a.handleDelayedReschedules(rescheduleLater, all, tg.Name) - desiredChanges.Stop += uint64(len(rescheduleLater)) // Create a structure for choosing names. Seed with the taken names which is // the union of untainted and migrating nodes (includes canaries) @@ -861,11 +860,6 @@ func (a *allocReconciler) handleDelayedReschedules(rescheduleLater []*delayedRes evals = append(evals, eval) for _, allocReschedInfo := range rescheduleLater { - a.result.stop = append(a.result.stop, allocStopResult{ - alloc: allocReschedInfo.alloc, - statusDescription: allocRescheduled, - }) - if allocReschedInfo.rescheduleTime.Sub(nextReschedTime) < batchedFailedAllocWindowSize { allocIDToFollowupEvalID[allocReschedInfo.allocID] = eval.ID } else { diff --git a/scheduler/reconcile_test.go b/scheduler/reconcile_test.go index fc7336c06..e12b52bd6 100644 --- a/scheduler/reconcile_test.go +++ b/scheduler/reconcile_test.go @@ -1320,13 +1320,13 @@ func TestReconciler_RescheduleLater_Batch(t *testing.T) { place: 0, inplace: 0, attributeUpdates: 1, - stop: 1, + stop: 0, desiredTGUpdates: map[string]*structs.DesiredUpdates{ job.TaskGroups[0].Name: { Place: 0, InPlaceUpdate: 0, Ignore: 4, - Stop: 1, + Stop: 0, }, }, }) @@ -1403,13 +1403,13 @@ func TestReconciler_RescheduleLaterWithBatchedEvals_Batch(t *testing.T) { place: 0, inplace: 0, attributeUpdates: 7, - stop: 7, + stop: 0, desiredTGUpdates: map[string]*structs.DesiredUpdates{ job.TaskGroups[0].Name: { Place: 0, InPlaceUpdate: 0, Ignore: 10, - Stop: 7, + Stop: 0, }, }, }) @@ -1568,13 +1568,13 @@ func TestReconciler_RescheduleLater_Service(t *testing.T) { place: 1, inplace: 0, attributeUpdates: 1, - stop: 1, + stop: 0, desiredTGUpdates: map[string]*structs.DesiredUpdates{ job.TaskGroups[0].Name: { Place: 1, InPlaceUpdate: 0, Ignore: 4, - Stop: 1, + Stop: 0, }, }, })