(runs []Run, maxAttempts int)
| 3978 | } |
| 3979 | |
| 3980 | func activeRunSummary(runs []Run, maxAttempts int) *RunSummary { |
| 3981 | var current *Run |
| 3982 | for idx := range runs { |
| 3983 | run := runs[idx] |
| 3984 | if isTerminalRunStatus(run.Status) { |
| 3985 | continue |
| 3986 | } |
| 3987 | if current == nil || prefersActiveRun(run, *current) { |
| 3988 | candidate := run |
| 3989 | current = &candidate |
| 3990 | } |
| 3991 | } |
| 3992 | if current == nil { |
| 3993 | return nil |
| 3994 | } |
| 3995 | summary := &RunSummary{ |
| 3996 | ID: current.ID, |
| 3997 | TaskID: current.TaskID, |
| 3998 | Status: current.Status, |
| 3999 | Attempt: current.Attempt, |
| 4000 | PreviousRunID: current.PreviousRunID, |
| 4001 | FailureKind: current.FailureKind, |
| 4002 | MaxAttempts: maxAttempts, |
| 4003 | SessionID: current.SessionID, |
| 4004 | ClaimedBy: cloneActorIdentity(current.ClaimedBy), |
| 4005 | ClaimTokenHash: current.ClaimTokenHash, |
| 4006 | LeaseUntil: current.LeaseUntil, |
| 4007 | HeartbeatAt: current.HeartbeatAt, |
| 4008 | CoordinationChannelID: current.CoordinationChannelID, |
| 4009 | DesignationGroupID: current.DesignationGroupID, |
| 4010 | QueuedAt: current.QueuedAt, |
| 4011 | ClaimedAt: current.ClaimedAt, |
| 4012 | StartedAt: current.StartedAt, |
| 4013 | EndedAt: current.EndedAt, |
| 4014 | Error: current.Error, |
| 4015 | } |
| 4016 | ApplyRunDesignationSummary(summary, *current) |
| 4017 | return summary |
| 4018 | } |
| 4019 | |
| 4020 | func prefersActiveRun(candidate Run, current Run) bool { |
| 4021 | candidateRank := activeRunRank(candidate.Status) |
no test coverage detected