Skip to content

Commit

Permalink
Order job 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 f6673d0 commit fb59bb1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pkg/scheduler/framework/session_plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,14 @@ func (ssn *Session) JobOrderFn(l, r interface{}) bool {
}
}

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

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

return lv.CreationTimestamp.Before(&rv.CreationTimestamp)
}

func (ssn *Session) QueueOrderFn(l, r interface{}) bool {
Expand Down

0 comments on commit fb59bb1

Please sign in to comment.