Merge pull request #4712 from hashicorp/b-failed-trigger-reason

Add a missing eval trigger reason
This commit is contained in:
Alex Dadgar 2018-09-25 10:50:16 -07:00 committed by GitHub
commit 10dee5108d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View file

@ -114,18 +114,21 @@ func (w *Worker) run() {
// Check for a shutdown // Check for a shutdown
if w.srv.IsShutdown() { if w.srv.IsShutdown() {
w.logger.Error("nacking eval because the server is shutting down", "eval", log.Fmt("%#v", eval))
w.sendAck(eval.ID, token, false) w.sendAck(eval.ID, token, false)
return return
} }
// Wait for the raft log to catchup to the evaluation // Wait for the raft log to catchup to the evaluation
if err := w.waitForIndex(waitIndex, raftSyncLimit); err != nil { if err := w.waitForIndex(waitIndex, raftSyncLimit); err != nil {
w.logger.Error("error waiting for Raft index", "error", err, "index", waitIndex)
w.sendAck(eval.ID, token, false) w.sendAck(eval.ID, token, false)
continue continue
} }
// Invoke the scheduler to determine placements // Invoke the scheduler to determine placements
if err := w.invokeScheduler(eval, token); err != nil { if err := w.invokeScheduler(eval, token); err != nil {
w.logger.Error("error invoking scheduler", "error", err)
w.sendAck(eval.ID, token, false) w.sendAck(eval.ID, token, false)
continue continue
} }

View file

@ -130,7 +130,8 @@ func (s *GenericScheduler) Process(eval *structs.Evaluation) error {
structs.EvalTriggerNodeDrain, structs.EvalTriggerNodeUpdate, structs.EvalTriggerNodeDrain, structs.EvalTriggerNodeUpdate,
structs.EvalTriggerRollingUpdate, structs.EvalTriggerQueuedAllocs, structs.EvalTriggerRollingUpdate, structs.EvalTriggerQueuedAllocs,
structs.EvalTriggerPeriodicJob, structs.EvalTriggerMaxPlans, structs.EvalTriggerPeriodicJob, structs.EvalTriggerMaxPlans,
structs.EvalTriggerDeploymentWatcher, structs.EvalTriggerRetryFailedAlloc: structs.EvalTriggerDeploymentWatcher, structs.EvalTriggerRetryFailedAlloc,
structs.EvalTriggerFailedFollowUp:
default: default:
desc := fmt.Sprintf("scheduler cannot handle '%s' evaluation reason", desc := fmt.Sprintf("scheduler cannot handle '%s' evaluation reason",
eval.TriggeredBy) eval.TriggeredBy)

View file

@ -60,7 +60,7 @@ func (s *SystemScheduler) Process(eval *structs.Evaluation) error {
// Verify the evaluation trigger reason is understood // Verify the evaluation trigger reason is understood
switch eval.TriggeredBy { switch eval.TriggeredBy {
case structs.EvalTriggerJobRegister, structs.EvalTriggerNodeUpdate, case structs.EvalTriggerJobRegister, structs.EvalTriggerNodeUpdate, structs.EvalTriggerFailedFollowUp,
structs.EvalTriggerJobDeregister, structs.EvalTriggerRollingUpdate, structs.EvalTriggerJobDeregister, structs.EvalTriggerRollingUpdate,
structs.EvalTriggerDeploymentWatcher, structs.EvalTriggerNodeDrain: structs.EvalTriggerDeploymentWatcher, structs.EvalTriggerNodeDrain:
default: default: