runservice: fix handling of wrong executortask status

updateRunTaskStatus should also accept transitions from not started to a
finished state like "success", "failed", "stopped" since we could miss some
status updates from the executor for many reasons.
This commit is contained in:
Simone Gotti 2020-02-28 13:02:35 +01:00
parent a4e280cd7d
commit 19611c18e7
1 changed files with 3 additions and 1 deletions

View File

@ -671,11 +671,13 @@ func (s *Runservice) updateRunTaskStatus(ctx context.Context, et *types.Executor
}
case types.ExecutorTaskPhaseStopped:
if rt.Status != types.RunTaskStatusStopped &&
rt.Status != types.RunTaskStatusNotStarted &&
rt.Status != types.RunTaskStatusRunning {
wrongstatus = true
}
case types.ExecutorTaskPhaseSuccess:
if rt.Status != types.RunTaskStatusSuccess &&
rt.Status != types.RunTaskStatusNotStarted &&
rt.Status != types.RunTaskStatusRunning {
wrongstatus = true
}
@ -687,7 +689,7 @@ func (s *Runservice) updateRunTaskStatus(ctx context.Context, et *types.Executor
}
}
if wrongstatus {
log.Warnf("wrong executor task %q status: %q, rt status: %q", et.ID, et.Status.Phase, rt.Status)
log.Warnf("ignoring wrong executor task %q status: %q, rt status: %q", et.ID, et.Status.Phase, rt.Status)
return nil
}