diff --git a/api/evaluations.go b/api/evaluations.go index a10c3cba57a2776fe345bd9d3ce6256d45fcf9ec..37774d321ca37a16d30440151d92240a5c68cdea 100644 --- a/api/evaluations.go +++ b/api/evaluations.go @@ -54,23 +54,23 @@ func (e *Evaluations) Allocations(evalID string, q *QueryOptions) ([]*Allocation // Evaluation is used to serialize an evaluation. type Evaluation struct { - ID string - Priority int - Type string - TriggeredBy string - JobID string - JobModifyIndex uint64 - NodeID string - NodeModifyIndex uint64 - Status string - StatusDescription string - Wait time.Duration - NextEval string - PreviousEval string - SpawnedBlockedEval string - FailedTGAllocs map[string]*AllocationMetric - CreateIndex uint64 - ModifyIndex uint64 + ID string + Priority int + Type string + TriggeredBy string + JobID string + JobModifyIndex uint64 + NodeID string + NodeModifyIndex uint64 + Status string + StatusDescription string + Wait time.Duration + NextEval string + PreviousEval string + BlockedEval string + FailedTGAllocs map[string]*AllocationMetric + CreateIndex uint64 + ModifyIndex uint64 } // EvalIndexSort is a wrapper to sort evaluations by CreateIndex. diff --git a/command/monitor.go b/command/monitor.go index f5417f26a8770cbd1839b3cbfacef31d160760d1..5cfe6810f3c60bc9a4dd4b64ab01f1010001e83f 100644 --- a/command/monitor.go +++ b/command/monitor.go @@ -307,9 +307,9 @@ func (m *monitor) monitor(evalID string, allowPrefix bool) int { dumpAllocMetrics(m.ui, metrics, false) } - if eval.SpawnedBlockedEval != "" { - m.ui.Output(fmt.Sprintf("Spawned follow up blocked evaluation %q to place remainder", - limit(eval.SpawnedBlockedEval, m.length))) + if eval.BlockedEval != "" { + m.ui.Output(fmt.Sprintf("Evaluation %q waiting for additional capacity to place remainder", + limit(eval.BlockedEval, m.length))) } } default: diff --git a/nomad/structs/structs.go b/nomad/structs/structs.go index 577893850bb536fee9114efc5fb9cbe920261f5d..4a70e96bb87e51d2a2952154aef3d543b80e4fc5 100644 --- a/nomad/structs/structs.go +++ b/nomad/structs/structs.go @@ -2617,10 +2617,10 @@ type Evaluation struct { // This is used to support rolling upgrades, where we need a chain of evaluations. PreviousEval string - // SpawnedBlockedEval is the evaluation ID for a created blocked eval. A + // BlockedEval is the evaluation ID for a created blocked eval. A // blocked eval will be created if all allocations could not be placed due // to constraints or lacking resources. - SpawnedBlockedEval string + BlockedEval string // FailedTGAllocs are task groups which have allocations that could not be // made, but the metrics are persisted so that the user can use the feedback @@ -2744,10 +2744,10 @@ func (e *Evaluation) NextRollingEval(wait time.Duration) *Evaluation { } } -// BlockedEval creates a blocked evaluation to followup this eval to place any +// CreateBlockedEval creates a blocked evaluation to followup this eval to place any // failed allocations. It takes the classes marked explicitly eligible or // ineligible and whether the job has escaped computed node classes. -func (e *Evaluation) BlockedEval(classEligibility map[string]bool, escaped bool) *Evaluation { +func (e *Evaluation) CreateBlockedEval(classEligibility map[string]bool, escaped bool) *Evaluation { return &Evaluation{ ID: GenerateUUID(), Priority: e.Priority, diff --git a/scheduler/generic_sched.go b/scheduler/generic_sched.go index 2595fbac7c867ea058c44ee3dd5c69c35bccc567..056c90d4eda75185d5083591e0b01486af2da61e 100644 --- a/scheduler/generic_sched.go +++ b/scheduler/generic_sched.go @@ -140,7 +140,7 @@ func (s *GenericScheduler) createBlockedEval() error { classEligibility = e.GetClasses() } - s.blocked = s.eval.BlockedEval(classEligibility, escaped) + s.blocked = s.eval.CreateBlockedEval(classEligibility, escaped) return s.planner.CreateEval(s.blocked) } @@ -370,11 +370,9 @@ func (s *GenericScheduler) computePlacements(place []allocTuple) error { for _, missing := range place { // Check if this task group has already failed - if s.eval.FailedTGAllocs != nil { - if metric, ok := s.eval.FailedTGAllocs[missing.TaskGroup.Name]; ok { - metric.CoalescedFailures += 1 - continue - } + if metric, ok := s.eval.FailedTGAllocs[missing.TaskGroup.Name]; ok { + metric.CoalescedFailures += 1 + continue } // Attempt to match the task group diff --git a/scheduler/generic_sched_test.go b/scheduler/generic_sched_test.go index 879da2a837dce3482876a3555cfbd33050ab4887..ff6b9830180887d42fa16ba6b349c86653a946e7 100644 --- a/scheduler/generic_sched_test.go +++ b/scheduler/generic_sched_test.go @@ -51,7 +51,7 @@ func TestServiceSched_JobRegister(t *testing.T) { // Ensure the eval has no spawned blocked eval if len(h.Evals) != 1 { t.Fatalf("bad: %#v", h.Evals) - if h.Evals[0].SpawnedBlockedEval != "" { + if h.Evals[0].BlockedEval != "" { t.Fatalf("bad: %#v", h.Evals[0]) } } @@ -248,7 +248,7 @@ func TestServiceSched_JobRegister_AllocFail(t *testing.T) { outEval := h.Evals[0] // Ensure the eval has its spawned blocked eval - if outEval.SpawnedBlockedEval != h.CreateEvals[0].ID { + if outEval.BlockedEval != h.CreateEvals[0].ID { t.Fatalf("bad: %#v", outEval) } @@ -432,7 +432,7 @@ func TestServiceSched_JobRegister_FeasibleAndInfeasibleTG(t *testing.T) { outEval := h.Evals[0] // Ensure the eval has its spawned blocked eval - if outEval.SpawnedBlockedEval != h.CreateEvals[0].ID { + if outEval.BlockedEval != h.CreateEvals[0].ID { t.Fatalf("bad: %#v", outEval) } diff --git a/scheduler/system_sched.go b/scheduler/system_sched.go index e0bef083ad64a2ba72a44302ed03b794778f2ca5..9f64e95be25cb46385c8d243e02322cb80eb7b1f 100644 --- a/scheduler/system_sched.go +++ b/scheduler/system_sched.go @@ -237,7 +237,7 @@ func (s *SystemScheduler) computePlacements(place []allocTuple) error { // Attempt to match the task group option, _ := s.stack.Select(missing.TaskGroup) - if option == nil && s.eval.FailedTGAllocs != nil { + if option == nil { // Check if this task group has already failed if metric, ok := s.eval.FailedTGAllocs[missing.TaskGroup.Name]; ok { metric.CoalescedFailures += 1 diff --git a/scheduler/util.go b/scheduler/util.go index 89ad49dc921ed04f380dd96ca7963d37f9050a6e..9961649c5478c7408328de245f1b8599323e10ac 100644 --- a/scheduler/util.go +++ b/scheduler/util.go @@ -365,7 +365,7 @@ func setStatus(logger *log.Logger, planner Planner, eval, nextEval, spawnedBlock newEval.NextEval = nextEval.ID } if spawnedBlocked != nil { - newEval.SpawnedBlockedEval = spawnedBlocked.ID + newEval.BlockedEval = spawnedBlocked.ID } return planner.UpdateEval(newEval) } diff --git a/scheduler/util_test.go b/scheduler/util_test.go index 73fc29f8f71238622c487e5b5cf40bfb2781a2ba..e9957a5012ae77d3e9fd2249b9de5e99140b448f 100644 --- a/scheduler/util_test.go +++ b/scheduler/util_test.go @@ -526,8 +526,8 @@ func TestSetStatus(t *testing.T) { } newEval = h.Evals[0] - if newEval.SpawnedBlockedEval != blocked.ID { - t.Fatalf("setStatus() didn't set SpawnedBlockedEval correctly: %v", newEval) + if newEval.BlockedEval != blocked.ID { + t.Fatalf("setStatus() didn't set BlockedEval correctly: %v", newEval) } }