Skip to content

Commit

Permalink
Order queue by CreationTimestamp first, then by UID
Browse files Browse the repository at this point in the history
  • Loading branch information
hex108 committed Mar 18, 2019
1 parent cbf66f8 commit f6673d0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/scheduler/framework/session_plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,14 @@ func (ssn *Session) QueueOrderFn(l, r interface{}) bool {
}
}

// If no queue order funcs, order queue by UID.
// If no queue order funcs, order queue by CreationTimestamp first, then by UID.
lv := l.(*api.QueueInfo)
rv := r.(*api.QueueInfo)

return lv.UID < rv.UID
if lv.Queue.CreationTimestamp.Equal(&rv.Queue.CreationTimestamp) {
return lv.UID < rv.UID
} else {
return lv.Queue.CreationTimestamp.Before(&rv.Queue.CreationTimestamp)
}
}

func (ssn *Session) TaskCompareFns(l, r interface{}) int {
Expand Down

0 comments on commit f6673d0

Please sign in to comment.