Remove unneeded saveTaskRunnerState method

Collapse it into the one place it's called
This commit is contained in:
Michael Schurter 2017-07-21 16:16:02 -07:00
parent 996ce9286e
commit 2e9a1e3fa6
1 changed files with 3 additions and 10 deletions

View File

@ -348,8 +348,9 @@ func (r *AllocRunner) SaveState() error {
runners := r.getTaskRunners()
var mErr multierror.Error
for _, tr := range runners {
if err := r.saveTaskRunnerState(tr); err != nil {
mErr.Errors = append(mErr.Errors, err)
if err := tr.SaveState(); err != nil {
mErr.Errors = append(mErr.Errors, fmt.Errorf("failed to save state for alloc %s task %q: %v",
r.allocID, tr.task.Name, err))
}
}
return mErr.ErrorOrNil()
@ -446,14 +447,6 @@ func (r *AllocRunner) saveAllocRunnerState() error {
})
}
func (r *AllocRunner) saveTaskRunnerState(tr *TaskRunner) error {
if err := tr.SaveState(); err != nil {
return fmt.Errorf("failed to save state for alloc %s task '%s': %v",
r.allocID, tr.task.Name, err)
}
return nil
}
// DestroyState is used to cleanup after ourselves
func (r *AllocRunner) DestroyState() error {
r.allocStateLock.Lock()