runservice: refactor fetch phase check
Use dedicated functions
This commit is contained in:
parent
7fa14c1b7a
commit
1657a35a6f
@ -1030,25 +1030,15 @@ func (s *Scheduler) finishedRunArchiver(ctx context.Context, r *types.Run) error
|
|||||||
|
|
||||||
done := true
|
done := true
|
||||||
for _, rt := range r.RunTasks {
|
for _, rt := range r.RunTasks {
|
||||||
// check all logs are fetched
|
// check that all logs are fetched
|
||||||
if rt.SetupStep.LogPhase != types.RunTaskFetchPhaseFinished {
|
if !rt.LogsFetchFinished() {
|
||||||
done = false
|
done = false
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
for _, rts := range rt.Steps {
|
// check that all archives are fetched
|
||||||
lp := rts.LogPhase
|
if !rt.ArchivesFetchFinished() {
|
||||||
if lp != types.RunTaskFetchPhaseFinished {
|
done = false
|
||||||
done = false
|
break
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// check all archives are fetched
|
|
||||||
for _, lp := range rt.WorkspaceArchivesPhase {
|
|
||||||
if lp != types.RunTaskFetchPhaseFinished {
|
|
||||||
done = false
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !done {
|
if !done {
|
||||||
|
@ -184,9 +184,22 @@ type RunTask struct {
|
|||||||
EndTime *time.Time `json:"end_time,omitempty"`
|
EndTime *time.Time `json:"end_time,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (rt *RunTask) LogsFetchFinished() bool {
|
||||||
|
if rt.SetupStep.LogPhase != RunTaskFetchPhaseFinished {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
for _, rts := range rt.Steps {
|
||||||
|
lp := rts.LogPhase
|
||||||
|
if lp != RunTaskFetchPhaseFinished {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
func (rt *RunTask) ArchivesFetchFinished() bool {
|
func (rt *RunTask) ArchivesFetchFinished() bool {
|
||||||
for _, p := range rt.WorkspaceArchivesPhase {
|
for _, p := range rt.WorkspaceArchivesPhase {
|
||||||
if p == RunTaskFetchPhaseNotStarted {
|
if p != RunTaskFetchPhaseFinished {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user