feat(actions): add waiting jobs view filtered by runner label
Adds a new page to view all waiting/blocked jobs for a specific runner label. This helps administrators identify which jobs are queued for particular runner labels and diagnose runner capacity issues.
This commit is contained in:
@@ -315,3 +315,24 @@ func GetQueueDepthByLabels(ctx context.Context) ([]QueueDepthByLabel, error) {
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// GetWaitingJobsByLabel returns all waiting/blocked jobs that have the specified label in their RunsOn
|
||||
func GetWaitingJobsByLabel(ctx context.Context, label string) ([]*ActionRunJob, error) {
|
||||
var jobs []*ActionRunJob
|
||||
err := db.GetEngine(ctx).Where("status IN (?, ?)", StatusWaiting, StatusBlocked).Find(&jobs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Filter by label
|
||||
var filtered []*ActionRunJob
|
||||
for _, job := range jobs {
|
||||
for _, l := range job.RunsOn {
|
||||
if l == label {
|
||||
filtered = append(filtered, job)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
return filtered, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user