Not restarting if a task exited properly

This commit is contained in:
Diptanu Choudhury
2015-11-22 23:47:15 -08:00
parent acc4c5568e
commit 29491ad47a

View File

@@ -276,15 +276,17 @@ func (r *TaskRunner) run() {
return
}
waitEvent := r.waitErrorToEvent(waitRes)
// Log whether the task was successful or not.
if !waitRes.Successful() {
r.logger.Printf("[ERR] client: failed to complete task '%s' for alloc '%s': %v", r.task.Name, r.allocID, waitRes)
} else {
r.logger.Printf("[INFO] client: completed task '%s' for alloc '%s'", r.task.Name, r.allocID)
r.setState(structs.TaskStateDead, waitEvent)
return
}
// Check if we should restart. If not mark task as dead and exit.
waitEvent := r.waitErrorToEvent(waitRes)
shouldRestart, when := r.restartTracker.nextRestart()
if !shouldRestart {
r.logger.Printf("[INFO] client: Not restarting task: %v for alloc: %v ", r.task.Name, r.allocID)