diff --git a/internal/services/gateway/api/run.go b/internal/services/gateway/api/run.go index 6bcb229..e5ada93 100644 --- a/internal/services/gateway/api/run.go +++ b/internal/services/gateway/api/run.go @@ -134,7 +134,7 @@ func createRunResponse(r *rstypes.Run, rc *rstypes.RunConfig) *RunResponse { run.CanRestartFromScratch, _ = r.CanRestartFromScratch() run.CanRestartFromFailedTasks, _ = r.CanRestartFromFailedTasks() - for name, rt := range r.RunTasks { + for name, rt := range r.Tasks { rct := rc.Tasks[rt.ID] run.Tasks[name] = createRunResponseTask(r, rt, rct) } @@ -258,7 +258,7 @@ func (h *RuntaskHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { run := runResp.Run rc := runResp.RunConfig - rt, ok := run.RunTasks[taskID] + rt, ok := run.Tasks[taskID] if !ok { httpError(w, util.NewErrNotFound(errors.Errorf("run %q task %q not found", runID, taskID))) return diff --git a/internal/services/runservice/scheduler/api/api.go b/internal/services/runservice/scheduler/api/api.go index 1766ed7..12caea2 100644 --- a/internal/services/runservice/scheduler/api/api.go +++ b/internal/services/runservice/scheduler/api/api.go @@ -186,7 +186,7 @@ func (h *LogsHandler) readTaskLogs(ctx context.Context, runID, taskID string, se return errors.Errorf("no such run with id: %s", runID), true } - task, ok := r.RunTasks[taskID] + task, ok := r.Tasks[taskID] if !ok { return errors.Errorf("no such task with ID %s in run %s", taskID, runID), true } diff --git a/internal/services/runservice/scheduler/command/command.go b/internal/services/runservice/scheduler/command/command.go index 6790614..4ec73c1 100644 --- a/internal/services/runservice/scheduler/command/command.go +++ b/internal/services/runservice/scheduler/command/command.go @@ -275,7 +275,7 @@ func recreateRun(uuid util.UUIDGenerator, run *types.Run, rc *types.RunConfig, n // currently we only restart a run resetting al failed tasks recreatedRCTasks := map[string]struct{}{} - for _, rt := range run.RunTasks { + for _, rt := range run.Tasks { if req.FromStart || rt.Status != types.RunTaskStatusSuccess { rct, ok := rc.Tasks[rt.ID] if !ok { @@ -343,19 +343,19 @@ func recreateRun(uuid util.UUIDGenerator, run *types.Run, rc *types.RunConfig, n // remove deleted tasks from run config tasksToDelete := []string{} - for _, rt := range run.RunTasks { + for _, rt := range run.Tasks { if _, ok := rc.Tasks[rt.ID]; !ok { tasksToDelete = append(tasksToDelete, rt.ID) } } for _, rtID := range tasksToDelete { - delete(run.RunTasks, rtID) + delete(run.Tasks, rtID) } // create new tasks from runconfig for _, rct := range rc.Tasks { - if _, ok := run.RunTasks[rct.ID]; !ok { + if _, ok := run.Tasks[rct.ID]; !ok { nrt := genRunTask(rct) - run.RunTasks[nrt.ID] = nrt + run.Tasks[nrt.ID] = nrt } } @@ -453,7 +453,7 @@ func genRun(rc *types.RunConfig) *types.Run { Annotations: rc.Annotations, Phase: types.RunPhaseQueued, Result: types.RunResultUnknown, - RunTasks: make(map[string]*types.RunTask), + Tasks: make(map[string]*types.RunTask), } if len(rc.SetupErrors) > 0 { @@ -463,7 +463,7 @@ func genRun(rc *types.RunConfig) *types.Run { for _, rct := range rc.Tasks { rt := genRunTask(rct) - r.RunTasks[rt.ID] = rt + r.Tasks[rt.ID] = rt } return r @@ -487,7 +487,7 @@ func (s *CommandHandler) ApproveRunTask(ctx context.Context, req *RunTaskApprove return err } - task, ok := r.RunTasks[req.TaskID] + task, ok := r.Tasks[req.TaskID] if !ok { return util.NewErrBadRequest(errors.Errorf("run %q doesn't have task %q", r.ID, req.TaskID)) } diff --git a/internal/services/runservice/scheduler/command/command_test.go b/internal/services/runservice/scheduler/command/command_test.go index 4887e2e..9a7d685 100644 --- a/internal/services/runservice/scheduler/command/command_test.go +++ b/internal/services/runservice/scheduler/command/command_test.go @@ -201,11 +201,11 @@ func TestRecreateRun(t *testing.T) { rc: rc.DeepCopy(), r: func() *types.Run { run := run.DeepCopy() - run.RunTasks[inuuid("task01")].Status = types.RunTaskStatusFailed - run.RunTasks[inuuid("task02")].Status = types.RunTaskStatusSuccess - run.RunTasks[inuuid("task03")].Status = types.RunTaskStatusSuccess - run.RunTasks[inuuid("task04")].Status = types.RunTaskStatusSuccess - run.RunTasks[inuuid("task05")].Status = types.RunTaskStatusSuccess + run.Tasks[inuuid("task01")].Status = types.RunTaskStatusFailed + run.Tasks[inuuid("task02")].Status = types.RunTaskStatusSuccess + run.Tasks[inuuid("task03")].Status = types.RunTaskStatusSuccess + run.Tasks[inuuid("task04")].Status = types.RunTaskStatusSuccess + run.Tasks[inuuid("task05")].Status = types.RunTaskStatusSuccess return run }(), outrc: outrc.DeepCopy(), @@ -217,11 +217,11 @@ func TestRecreateRun(t *testing.T) { rc: rc.DeepCopy(), r: func() *types.Run { run := run.DeepCopy() - run.RunTasks[inuuid("task01")].Status = types.RunTaskStatusFailed - run.RunTasks[inuuid("task02")].Status = types.RunTaskStatusSuccess - run.RunTasks[inuuid("task03")].Status = types.RunTaskStatusSuccess - run.RunTasks[inuuid("task04")].Status = types.RunTaskStatusSuccess - run.RunTasks[inuuid("task05")].Status = types.RunTaskStatusSuccess + run.Tasks[inuuid("task01")].Status = types.RunTaskStatusFailed + run.Tasks[inuuid("task02")].Status = types.RunTaskStatusSuccess + run.Tasks[inuuid("task03")].Status = types.RunTaskStatusSuccess + run.Tasks[inuuid("task04")].Status = types.RunTaskStatusSuccess + run.Tasks[inuuid("task05")].Status = types.RunTaskStatusSuccess return run }(), // task01 and task02 recreated @@ -246,17 +246,17 @@ func TestRecreateRun(t *testing.T) { outrun := outrun.DeepCopy() nrun := run.DeepCopy() nrun.ID = outuuid("new") - nrun.RunTasks = map[string]*types.RunTask{ - outuuid("task01"): outrun.RunTasks[outuuid("task01")], - outuuid("task02"): outrun.RunTasks[outuuid("task02")], - inuuid("task03"): run.RunTasks[inuuid("task03")], - inuuid("task04"): run.RunTasks[inuuid("task04")], - inuuid("task05"): run.RunTasks[inuuid("task05")], + nrun.Tasks = map[string]*types.RunTask{ + outuuid("task01"): outrun.Tasks[outuuid("task01")], + outuuid("task02"): outrun.Tasks[outuuid("task02")], + inuuid("task03"): run.Tasks[inuuid("task03")], + inuuid("task04"): run.Tasks[inuuid("task04")], + inuuid("task05"): run.Tasks[inuuid("task05")], } - nrun.RunTasks[inuuid("task03")].Status = types.RunTaskStatusSuccess - nrun.RunTasks[inuuid("task04")].Status = types.RunTaskStatusSuccess - nrun.RunTasks[inuuid("task05")].Status = types.RunTaskStatusSuccess + nrun.Tasks[inuuid("task03")].Status = types.RunTaskStatusSuccess + nrun.Tasks[inuuid("task04")].Status = types.RunTaskStatusSuccess + nrun.Tasks[inuuid("task05")].Status = types.RunTaskStatusSuccess return nrun }(), diff --git a/internal/services/runservice/scheduler/scheduler.go b/internal/services/runservice/scheduler/scheduler.go index be8e7ee..201e096 100644 --- a/internal/services/runservice/scheduler/scheduler.go +++ b/internal/services/runservice/scheduler/scheduler.go @@ -95,7 +95,7 @@ func advanceRunTasks(ctx context.Context, r *types.Run, rc *types.RunConfig) err log.Debugf("rc: %s", util.Dump(rc)) // get tasks that can be executed - for _, rt := range r.RunTasks { + for _, rt := range r.Tasks { if rt.Skip { continue } @@ -107,7 +107,7 @@ func advanceRunTasks(ctx context.Context, r *types.Run, rc *types.RunConfig) err parents := runconfig.GetParents(rc.Tasks, rct) finishedParents := 0 for _, p := range parents { - rp := r.RunTasks[p.ID] + rp := r.Tasks[p.ID] if rp.Status.IsFinished() && rp.ArchivesFetchFinished() { finishedParents++ } @@ -120,7 +120,7 @@ func advanceRunTasks(ctx context.Context, r *types.Run, rc *types.RunConfig) err if allParentsFinished { for _, p := range parents { matched := false - rp := r.RunTasks[p.ID] + rp := r.Tasks[p.ID] conds := runconfig.GetParentDependConditions(rct, p) for _, cond := range conds { switch cond { @@ -166,7 +166,7 @@ func getTasksToRun(ctx context.Context, r *types.Run, rc *types.RunConfig) ([]*t tasksToRun := []*types.RunTask{} // get tasks that can be executed - for _, rt := range r.RunTasks { + for _, rt := range r.Tasks { if rt.Skip { continue } @@ -178,7 +178,7 @@ func getTasksToRun(ctx context.Context, r *types.Run, rc *types.RunConfig) ([]*t parents := runconfig.GetParents(rc.Tasks, rct) finishedParents := 0 for _, p := range parents { - rp := r.RunTasks[p.ID] + rp := r.Tasks[p.ID] if rp.Status.IsFinished() && rp.ArchivesFetchFinished() { finishedParents++ } @@ -291,7 +291,7 @@ func (s *Scheduler) genExecutorTask(ctx context.Context, r *types.Run, rt *types log.Debugf("rctParent: %s", util.Dump(rctParent)) log.Debugf("ws: %s", util.Dump(ws)) archives := []types.WorkspaceArchive{} - for _, archiveStep := range r.RunTasks[rctParent.ID].WorkspaceArchives { + for _, archiveStep := range r.Tasks[rctParent.ID].WorkspaceArchives { archives = append(archives, types.WorkspaceArchive{TaskID: rctParent.ID, Step: archiveStep}) } log.Debugf("archives: %v", util.Dump(archives)) @@ -471,7 +471,7 @@ func advanceRun(ctx context.Context, r *types.Run, rc *types.RunConfig, hasActiv // fail run if a task is failed if !r.Result.IsSet() && r.Phase == types.RunPhaseRunning { - for _, rt := range r.RunTasks { + for _, rt := range r.Tasks { rct, ok := rc.Tasks[rt.ID] log.Debugf("rct: %s", util.Dump(rct)) if !ok { @@ -490,7 +490,7 @@ func advanceRun(ctx context.Context, r *types.Run, rc *types.RunConfig, hasActiv // see if run could be marked as success if !r.Result.IsSet() && r.Phase == types.RunPhaseRunning { finished := true - for _, rt := range r.RunTasks { + for _, rt := range r.Tasks { if !rt.Status.IsFinished() { finished = false } @@ -512,7 +512,7 @@ func advanceRun(ctx context.Context, r *types.Run, rc *types.RunConfig, hasActiv // the run phase as finished if r.Result.IsSet() { finished := true - for _, rt := range r.RunTasks { + for _, rt := range r.Tasks { if !rt.Status.IsFinished() { finished = false } @@ -527,7 +527,7 @@ func advanceRun(ctx context.Context, r *types.Run, rc *types.RunConfig, hasActiv // if the run is finished AND there're no executor tasks scheduled we can mark // all not started runtasks' fetch phases (setup step, logs and archives) as finished if r.Phase.IsFinished() { - for _, rt := range r.RunTasks { + for _, rt := range r.Tasks { log.Debugf("rt: %s", util.Dump(rt)) if rt.Status == types.RunTaskStatusNotStarted { rt.SetupStep.LogPhase = types.RunTaskFetchPhaseFinished @@ -569,7 +569,7 @@ func (s *Scheduler) handleExecutorTaskUpdate(ctx context.Context, et *types.Exec func (s *Scheduler) updateRunTaskStatus(ctx context.Context, et *types.ExecutorTask, r *types.Run) error { log.Debugf("et: %s", util.Dump(et)) - rt, ok := r.RunTasks[et.ID] + rt, ok := r.Tasks[et.ID] if !ok { return errors.Errorf("no such run task with id %s for run %s", et.ID, r.ID) } @@ -865,7 +865,7 @@ func (s *Scheduler) finishSetupLogPhase(ctx context.Context, runID, runTaskID st if err != nil { return err } - rt, ok := r.RunTasks[runTaskID] + rt, ok := r.Tasks[runTaskID] if !ok { return errors.Errorf("no such task with ID %s in run %s", runTaskID, runID) } @@ -882,7 +882,7 @@ func (s *Scheduler) finishStepLogPhase(ctx context.Context, runID, runTaskID str if err != nil { return err } - rt, ok := r.RunTasks[runTaskID] + rt, ok := r.Tasks[runTaskID] if !ok { return errors.Errorf("no such task with ID %s in run %s", runTaskID, runID) } @@ -902,7 +902,7 @@ func (s *Scheduler) finishArchivePhase(ctx context.Context, runID, runTaskID str if err != nil { return err } - rt, ok := r.RunTasks[runTaskID] + rt, ok := r.Tasks[runTaskID] if !ok { return errors.Errorf("no such task with ID %s in run %s", runTaskID, runID) } @@ -1045,7 +1045,7 @@ func (s *Scheduler) fetcher(ctx context.Context) error { } for _, r := range runs { log.Debugf("r: %s", util.Dump(r)) - for _, rt := range r.RunTasks { + for _, rt := range r.Tasks { log.Debugf("rt: %s", util.Dump(rt)) if rt.Status.IsFinished() { s.fetchTaskLogs(ctx, r.ID, rt) @@ -1160,7 +1160,7 @@ func (s *Scheduler) finishedRunArchiver(ctx context.Context, r *types.Run) error } done := true - for _, rt := range r.RunTasks { + for _, rt := range r.Tasks { // check that all logs are fetched if !rt.LogsFetchFinished() { done = false @@ -1181,7 +1181,7 @@ func (s *Scheduler) finishedRunArchiver(ctx context.Context, r *types.Run) error // remove it before since it contains the reference to the executor where we // should fetch the data - for _, rt := range r.RunTasks { + for _, rt := range r.Tasks { log.Infof("deleting executor task %s", rt.ID) if err := store.DeleteExecutorTask(ctx, s.e, rt.ID); err != nil { return err diff --git a/internal/services/runservice/scheduler/scheduler_test.go b/internal/services/runservice/scheduler/scheduler_test.go index bfde958..0ba108d 100644 --- a/internal/services/runservice/scheduler/scheduler_test.go +++ b/internal/services/runservice/scheduler/scheduler_test.go @@ -93,7 +93,7 @@ func TestAdvanceRunTasks(t *testing.T) { // (if the runconfig task as Skip == true). This must match the status // generated by command.genRun() run := &types.Run{ - RunTasks: map[string]*types.RunTask{ + Tasks: map[string]*types.RunTask{ "task01": &types.RunTask{ ID: "task01", Status: types.RunTaskStatusNotStarted, @@ -139,13 +139,13 @@ func TestAdvanceRunTasks(t *testing.T) { }(), r: func() *types.Run { run := run.DeepCopy() - run.RunTasks["task01"].Status = types.RunTaskStatusSkipped + run.Tasks["task01"].Status = types.RunTaskStatusSkipped return run }(), out: func() *types.Run { run := run.DeepCopy() - run.RunTasks["task01"].Status = types.RunTaskStatusSkipped - run.RunTasks["task02"].Status = types.RunTaskStatusSkipped + run.Tasks["task01"].Status = types.RunTaskStatusSkipped + run.Tasks["task02"].Status = types.RunTaskStatusSkipped return run }(), }, @@ -159,15 +159,15 @@ func TestAdvanceRunTasks(t *testing.T) { }(), r: func() *types.Run { run := run.DeepCopy() - run.RunTasks["task03"].Status = types.RunTaskStatusSkipped - run.RunTasks["task04"].Status = types.RunTaskStatusSkipped + run.Tasks["task03"].Status = types.RunTaskStatusSkipped + run.Tasks["task04"].Status = types.RunTaskStatusSkipped return run }(), out: func() *types.Run { run := run.DeepCopy() - run.RunTasks["task03"].Status = types.RunTaskStatusSkipped - run.RunTasks["task04"].Status = types.RunTaskStatusSkipped - run.RunTasks["task05"].Status = types.RunTaskStatusSkipped + run.Tasks["task03"].Status = types.RunTaskStatusSkipped + run.Tasks["task04"].Status = types.RunTaskStatusSkipped + run.Tasks["task05"].Status = types.RunTaskStatusSkipped return run }(), }, @@ -180,15 +180,15 @@ func TestAdvanceRunTasks(t *testing.T) { }(), r: func() *types.Run { run := run.DeepCopy() - run.RunTasks["task03"].Status = types.RunTaskStatusSkipped - run.RunTasks["task04"].Status = types.RunTaskStatusSuccess + run.Tasks["task03"].Status = types.RunTaskStatusSkipped + run.Tasks["task04"].Status = types.RunTaskStatusSuccess return run }(), out: func() *types.Run { run := run.DeepCopy() - run.RunTasks["task03"].Status = types.RunTaskStatusSkipped - run.RunTasks["task04"].Status = types.RunTaskStatusSuccess - run.RunTasks["task05"].Status = types.RunTaskStatusSkipped + run.Tasks["task03"].Status = types.RunTaskStatusSkipped + run.Tasks["task04"].Status = types.RunTaskStatusSuccess + run.Tasks["task05"].Status = types.RunTaskStatusSkipped return run }(), }, @@ -201,15 +201,15 @@ func TestAdvanceRunTasks(t *testing.T) { }(), r: func() *types.Run { run := run.DeepCopy() - run.RunTasks["task03"].Status = types.RunTaskStatusSkipped - run.RunTasks["task04"].Status = types.RunTaskStatusSuccess + run.Tasks["task03"].Status = types.RunTaskStatusSkipped + run.Tasks["task04"].Status = types.RunTaskStatusSuccess return run }(), out: func() *types.Run { run := run.DeepCopy() - run.RunTasks["task03"].Status = types.RunTaskStatusSkipped - run.RunTasks["task04"].Status = types.RunTaskStatusSuccess - run.RunTasks["task05"].Status = types.RunTaskStatusSkipped + run.Tasks["task03"].Status = types.RunTaskStatusSkipped + run.Tasks["task04"].Status = types.RunTaskStatusSuccess + run.Tasks["task05"].Status = types.RunTaskStatusSkipped return run }(), }, @@ -223,15 +223,15 @@ func TestAdvanceRunTasks(t *testing.T) { }(), r: func() *types.Run { run := run.DeepCopy() - run.RunTasks["task03"].Status = types.RunTaskStatusSkipped - run.RunTasks["task04"].Status = types.RunTaskStatusSuccess + run.Tasks["task03"].Status = types.RunTaskStatusSkipped + run.Tasks["task04"].Status = types.RunTaskStatusSuccess return run }(), out: func() *types.Run { run := run.DeepCopy() - run.RunTasks["task03"].Status = types.RunTaskStatusSkipped - run.RunTasks["task04"].Status = types.RunTaskStatusSuccess - run.RunTasks["task05"].Status = types.RunTaskStatusSkipped + run.Tasks["task03"].Status = types.RunTaskStatusSkipped + run.Tasks["task04"].Status = types.RunTaskStatusSuccess + run.Tasks["task05"].Status = types.RunTaskStatusSkipped return run }(), }, @@ -245,14 +245,14 @@ func TestAdvanceRunTasks(t *testing.T) { }(), r: func() *types.Run { run := run.DeepCopy() - run.RunTasks["task03"].Status = types.RunTaskStatusSkipped - run.RunTasks["task04"].Status = types.RunTaskStatusSuccess + run.Tasks["task03"].Status = types.RunTaskStatusSkipped + run.Tasks["task04"].Status = types.RunTaskStatusSuccess return run }(), out: func() *types.Run { run := run.DeepCopy() - run.RunTasks["task03"].Status = types.RunTaskStatusSkipped - run.RunTasks["task04"].Status = types.RunTaskStatusSuccess + run.Tasks["task03"].Status = types.RunTaskStatusSkipped + run.Tasks["task04"].Status = types.RunTaskStatusSuccess return run }(), }, @@ -266,15 +266,15 @@ func TestAdvanceRunTasks(t *testing.T) { }(), r: func() *types.Run { run := run.DeepCopy() - run.RunTasks["task03"].Status = types.RunTaskStatusSkipped - run.RunTasks["task04"].Status = types.RunTaskStatusSuccess + run.Tasks["task03"].Status = types.RunTaskStatusSkipped + run.Tasks["task04"].Status = types.RunTaskStatusSuccess return run }(), out: func() *types.Run { run := run.DeepCopy() - run.RunTasks["task03"].Status = types.RunTaskStatusSkipped - run.RunTasks["task04"].Status = types.RunTaskStatusSuccess - run.RunTasks["task05"].Status = types.RunTaskStatusSkipped + run.Tasks["task03"].Status = types.RunTaskStatusSkipped + run.Tasks["task04"].Status = types.RunTaskStatusSuccess + run.Tasks["task05"].Status = types.RunTaskStatusSkipped return run }(), }, @@ -289,15 +289,15 @@ func TestAdvanceRunTasks(t *testing.T) { }(), r: func() *types.Run { run := run.DeepCopy() - run.RunTasks["task03"].Status = types.RunTaskStatusSkipped - run.RunTasks["task04"].Status = types.RunTaskStatusSuccess + run.Tasks["task03"].Status = types.RunTaskStatusSkipped + run.Tasks["task04"].Status = types.RunTaskStatusSuccess return run }(), out: func() *types.Run { run := run.DeepCopy() - run.RunTasks["task03"].Status = types.RunTaskStatusSkipped - run.RunTasks["task04"].Status = types.RunTaskStatusSuccess - run.RunTasks["task05"].WaitingApproval = true + run.Tasks["task03"].Status = types.RunTaskStatusSkipped + run.Tasks["task04"].Status = types.RunTaskStatusSuccess + run.Tasks["task05"].WaitingApproval = true return run }(), }, @@ -386,7 +386,7 @@ func TestGetTasksToRun(t *testing.T) { // (if the runconfig task as Skip == true). This must match the status // generated by command.genRun() run := &types.Run{ - RunTasks: map[string]*types.RunTask{ + Tasks: map[string]*types.RunTask{ "task01": &types.RunTask{ ID: "task01", Status: types.RunTaskStatusNotStarted, @@ -432,8 +432,8 @@ func TestGetTasksToRun(t *testing.T) { }(), r: func() *types.Run { run := run.DeepCopy() - run.RunTasks["task01"].Status = types.RunTaskStatusSkipped - run.RunTasks["task02"].Status = types.RunTaskStatusSkipped + run.Tasks["task01"].Status = types.RunTaskStatusSkipped + run.Tasks["task02"].Status = types.RunTaskStatusSkipped return run }(), out: []string{"task03", "task04"}, @@ -457,7 +457,7 @@ func TestGetTasksToRun(t *testing.T) { }(), r: func() *types.Run { run := run.DeepCopy() - run.RunTasks["task01"].Approved = true + run.Tasks["task01"].Approved = true return run }(), out: []string{"task01", "task03", "task04"}, diff --git a/internal/services/runservice/scheduler/store/store.go b/internal/services/runservice/scheduler/store/store.go index 30c2a56..9b39a24 100644 --- a/internal/services/runservice/scheduler/store/store.go +++ b/internal/services/runservice/scheduler/store/store.go @@ -328,8 +328,8 @@ func GetExecutorTasksForRun(ctx context.Context, e *etcd.Store, runID string) ([ return nil, err } - rtIDs := make([]string, len(r.RunTasks)) - for rtID, _ := range r.RunTasks { + rtIDs := make([]string, len(r.Tasks)) + for rtID, _ := range r.Tasks { rtIDs = append(rtIDs, rtID) } diff --git a/internal/services/runservice/types/types.go b/internal/services/runservice/types/types.go index d8d76fb..2559265 100644 --- a/internal/services/runservice/types/types.go +++ b/internal/services/runservice/types/types.go @@ -110,7 +110,7 @@ type Run struct { // Stop is used to signal from the scheduler when the run must be stopped Stop bool `json:"stop,omitempty"` - RunTasks map[string]*RunTask `json:"run_tasks,omitempty"` + Tasks map[string]*RunTask `json:"tasks,omitempty"` EnqueueTime *time.Time `json:"enqueue_time,omitempty"` StartTime *time.Time `json:"start_time,omitempty"` EndTime *time.Time `json:"end_time,omitempty"` @@ -141,7 +141,7 @@ func (r *Run) ChangePhase(phase RunPhase) { func (r *Run) TasksWaitingApproval() []string { runTasksIDs := []string{} - for _, rt := range r.RunTasks { + for _, rt := range r.Tasks { if rt.WaitingApproval { runTasksIDs = append(runTasksIDs, rt.ID) } @@ -175,7 +175,7 @@ func (r *Run) CanRestartFromFailedTasks() (bool, string) { return false, fmt.Sprintf("run %q has success result, cannot restart from failed tasks", r.ID) } // can restart only if the successful tasks are fully archived - for _, rt := range r.RunTasks { + for _, rt := range r.Tasks { if rt.Status == RunTaskStatusSuccess { if !rt.LogsFetchFinished() || !rt.ArchivesFetchFinished() { return false, fmt.Sprintf("run %q task %q not fully archived", r.ID, rt.ID)