Merge pull request #4716 from hashicorp/f-no-reuse-triggerby

Unique TriggerBy for blocked evals
This commit is contained in:
Alex Dadgar 2018-09-24 16:08:31 -07:00 committed by GitHub
commit a7de6d1bb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View File

@ -6751,6 +6751,7 @@ const (
EvalTriggerFailedFollowUp = "failed-follow-up" EvalTriggerFailedFollowUp = "failed-follow-up"
EvalTriggerMaxPlans = "max-plan-attempts" EvalTriggerMaxPlans = "max-plan-attempts"
EvalTriggerRetryFailedAlloc = "alloc-failure" EvalTriggerRetryFailedAlloc = "alloc-failure"
EvalTriggerQueuedAllocs = "queued-allocs"
) )
const ( const (
@ -7016,7 +7017,7 @@ func (e *Evaluation) CreateBlockedEval(classEligibility map[string]bool,
Namespace: e.Namespace, Namespace: e.Namespace,
Priority: e.Priority, Priority: e.Priority,
Type: e.Type, Type: e.Type,
TriggeredBy: e.TriggeredBy, TriggeredBy: EvalTriggerQueuedAllocs,
JobID: e.JobID, JobID: e.JobID,
JobModifyIndex: e.JobModifyIndex, JobModifyIndex: e.JobModifyIndex,
Status: EvalStatusBlocked, Status: EvalStatusBlocked,

View File

@ -128,7 +128,7 @@ func (s *GenericScheduler) Process(eval *structs.Evaluation) error {
switch eval.TriggeredBy { switch eval.TriggeredBy {
case structs.EvalTriggerJobRegister, structs.EvalTriggerJobDeregister, case structs.EvalTriggerJobRegister, structs.EvalTriggerJobDeregister,
structs.EvalTriggerNodeDrain, structs.EvalTriggerNodeUpdate, structs.EvalTriggerNodeDrain, structs.EvalTriggerNodeUpdate,
structs.EvalTriggerRollingUpdate, structs.EvalTriggerRollingUpdate, structs.EvalTriggerQueuedAllocs,
structs.EvalTriggerPeriodicJob, structs.EvalTriggerMaxPlans, structs.EvalTriggerPeriodicJob, structs.EvalTriggerMaxPlans,
structs.EvalTriggerDeploymentWatcher, structs.EvalTriggerRetryFailedAlloc: structs.EvalTriggerDeploymentWatcher, structs.EvalTriggerRetryFailedAlloc:
default: default:

View File

@ -241,6 +241,10 @@ func TestServiceSched_JobRegister_DiskConstraints(t *testing.T) {
t.Fatalf("bad: %#v", h.CreateEvals) t.Fatalf("bad: %#v", h.CreateEvals)
} }
if h.CreateEvals[0].TriggeredBy != structs.EvalTriggerQueuedAllocs {
t.Fatalf("bad: %#v", h.CreateEvals[0])
}
// Ensure the plan allocated only one allocation // Ensure the plan allocated only one allocation
var planned []*structs.Allocation var planned []*structs.Allocation
for _, allocList := range plan.NodeAllocation { for _, allocList := range plan.NodeAllocation {