-
Notifications
You must be signed in to change notification settings - Fork 772
Ensure consistent preemptor state across queue heads and second pass #14815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
9f2b91c
e16da68
50309c7
231accc
338f571
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -919,30 +919,35 @@ func (m *Manager) Heads(ctx context.Context) []Head { | |
| } | ||
| } | ||
|
|
||
| // heads returns the heads of the queues and ready second-pass workloads. | ||
| func (m *Manager) heads() []Head { | ||
| heads := m.secondPassQueue.takeAllReady() | ||
| var heads []Head | ||
| for wInfo := range m.secondPassQueue.takeAllReady() { | ||
| isPreemptor := false | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One thing I'm worried about here is whether we want to say "isPreemptor = false" when the queue is missing? So far I don't believe it will make a difference but if the method is indeed returning a Head object with the field populated, someone might theoretically use the field without being aware that false might mean "cq missing". As such, I think we should confirm if it is okay for (cq == nil) => (isPreemptor == false) |
||
| if cq := m.getClusterQueueLockless(wInfo.ClusterQueue); cq != nil { | ||
| isPreemptor = cq.IsPreemptor(&wInfo) | ||
| } | ||
| heads = append(heads, Head{ | ||
| Info: wInfo, | ||
| IsPreemptor: isPreemptor, | ||
| }) | ||
| } | ||
| for cqName, cq := range m.hm.ClusterQueues() { | ||
| // Cache might be nil in tests, if cache is nil, we'll skip the check. | ||
| if m.statusChecker != nil && !m.statusChecker.ClusterQueueActive(cqName) { | ||
| continue | ||
| } | ||
| wl := cq.Pop() | ||
| head := cq.PopHead() | ||
| reportCQPendingWorkloads(m, cq) | ||
| if wl == nil { | ||
| if head == nil { | ||
| continue | ||
| } | ||
| wlKey := workload.Key(wl.Obj) | ||
| wlCopy := *wl | ||
| wlCopy.ClusterQueue = cqName | ||
| heads = append(heads, Head{ | ||
| Info: wlCopy, | ||
| IsPreemptor: cq.IsPreemptor(wl), | ||
| }) | ||
|
|
||
| head.ClusterQueue = cqName | ||
| heads = append(heads, *head) | ||
| wlKey := workload.Key(head.Obj) | ||
| qKey := m.workloadAssignedQueues[wlKey] | ||
| q := m.localQueues[qKey] | ||
| delete(q.items, wlKey) | ||
|
|
||
| reportLQPendingWorkloads(m, q) | ||
| } | ||
| return heads | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.