From 3b4cb6dbc9c433a4c15f95aebee19e8de2177e25 Mon Sep 17 00:00:00 2001 From: Diptanu Choudhury Date: Thu, 12 Nov 2015 15:53:42 -0800 Subject: [PATCH] Saving state of the Task Runner while it's trying to update it --- client/alloc_runner.go | 3 --- client/task_runner.go | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/alloc_runner.go b/client/alloc_runner.go index 6f0db3db5..aa7cf79e5 100644 --- a/client/alloc_runner.go +++ b/client/alloc_runner.go @@ -279,9 +279,6 @@ func (r *AllocRunner) setTaskStatus(taskName, status, desc string) { Description: desc, } r.taskStatusLock.Unlock() - if tr, ok := r.tasks[taskName]; ok { - r.saveTaskRunnerState(tr) - } select { case r.dirtyCh <- struct{}{}: default: diff --git a/client/task_runner.go b/client/task_runner.go index deaae5cae..c8a5a390a 100644 --- a/client/task_runner.go +++ b/client/task_runner.go @@ -134,6 +134,9 @@ func (r *TaskRunner) DestroyState() error { // setStatus is used to update the status of the task runner func (r *TaskRunner) setStatus(status, desc string) { + if err := r.SaveState(); err != nil { + r.logger.Printf("[ERR] client: failed to save state of Task Runner: %v", r.task.Name) + } r.updater(r.task.Name, status, desc) }