( ctx context.Context, taskRecord Task, target InspectTarget, focusedRunID string, )
| 51 | } |
| 52 | |
| 53 | func (m *Service) inspectTaskRecord( |
| 54 | ctx context.Context, |
| 55 | taskRecord Task, |
| 56 | target InspectTarget, |
| 57 | focusedRunID string, |
| 58 | ) (*InspectView, error) { |
| 59 | asOf := m.now().UTC() |
| 60 | childCount, err := m.store.CountDirectChildren(ctx, taskRecord.ID) |
| 61 | if err != nil { |
| 62 | return nil, err |
| 63 | } |
| 64 | dependencies, err := m.store.ListDependencies(ctx, taskRecord.ID) |
| 65 | if err != nil { |
| 66 | return nil, err |
| 67 | } |
| 68 | runs, err := m.store.ListTaskRuns(ctx, RunQuery{TaskID: taskRecord.ID}) |
| 69 | if err != nil { |
| 70 | return nil, err |
| 71 | } |
| 72 | events, err := m.store.ListTaskEvents(ctx, EventQuery{TaskID: taskRecord.ID, Limit: 1}) |
| 73 | if err != nil { |
| 74 | return nil, err |
| 75 | } |
| 76 | |
| 77 | summary, err := m.enrichTaskSummaryFromState(ctx, taskRecord, childCount, dependencies, runs, events) |
| 78 | if err != nil { |
| 79 | return nil, err |
| 80 | } |
| 81 | |
| 82 | currentRun := inspectCurrentRun(runs, taskRecord.CurrentRunID, focusedRunID) |
| 83 | currentRunSummary := inspectRunSummaryPtr(currentRun, asOf) |
| 84 | recentRuns := inspectRecentRuns(runs, asOf) |
| 85 | boundSession, sessionCatalogPresent, eligibleSessionCount, err := m.inspectSessionState( |
| 86 | ctx, |
| 87 | taskRecord, |
| 88 | currentRunSummary, |
| 89 | ) |
| 90 | if err != nil { |
| 91 | return nil, err |
| 92 | } |
| 93 | scheduler, err := m.inspectSchedulerState(ctx) |
| 94 | if err != nil { |
| 95 | return nil, err |
| 96 | } |
| 97 | recentEvents, err := m.inspectRecentEvents(ctx, taskRecord.ID, focusedRunID) |
| 98 | if err != nil { |
| 99 | return nil, err |
| 100 | } |
| 101 | |
| 102 | view := &InspectView{ |
| 103 | Target: target, |
| 104 | Task: summary, |
| 105 | CurrentRun: currentRunSummary, |
| 106 | BoundSession: boundSession, |
| 107 | RecentRuns: recentRuns, |
| 108 | RecentEvents: recentEvents, |
| 109 | Scheduler: scheduler, |
| 110 | AsOf: asOf, |
no test coverage detected