gateway/api: report if the run can be restarted

This commit is contained in:
Simone Gotti 2019-03-29 09:22:34 +01:00
parent c9089c3ccc
commit 1e41e3ad33
1 changed files with 6 additions and 0 deletions

View File

@ -58,6 +58,9 @@ type RunResponse struct {
EnqueueTime *time.Time `json:"enqueue_time"`
StartTime *time.Time `json:"start_time"`
EndTime *time.Time `json:"end_time"`
CanRestartFromScratch bool `json:"can_restart_from_scratch"`
CanRestartFromFailedTasks bool `json:"can_restart_from_failed_tasks"`
}
type RunResponseTask struct {
@ -116,6 +119,9 @@ func createRunResponse(r *rstypes.Run, rc *rstypes.RunConfig) *RunResponse {
EndTime: r.EndTime,
}
run.CanRestartFromScratch, _ = r.CanRestartFromScratch()
run.CanRestartFromFailedTasks, _ = r.CanRestartFromFailedTasks()
for name, rt := range r.RunTasks {
rct := rc.Tasks[rt.ID]
run.Tasks[name] = createRunResponseTask(r, rt, rct)