Skip to content

Commit

Permalink
scheduler: simplify code for drf plugin
Browse files Browse the repository at this point in the history
Replace the if-else statement with the min func provided by Go.

Signed-off-by: bogo_y <[email protected]>
  • Loading branch information
bogo-y committed Dec 10, 2024
1 parent 1d9b36f commit d2cdc4c
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions pkg/scheduler/plugins/drf/drf.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,7 @@ func (drf *drfPlugin) compareQueues(root *hierarchicalNode, lqueue *api.QueueInf
lpaths := strings.Split(lqueue.Hierarchy, "/")
rnode := root
rpaths := strings.Split(rqueue.Hierarchy, "/")
depth := 0
if len(lpaths) < len(rpaths) {
depth = len(lpaths)
} else {
depth = len(rpaths)
}
for i := 0; i < depth; i++ {
for i, depth := 0, min(len(lpaths), len(rpaths)); i < depth; i++ {
// Saturated nodes have minumun prioirty,
// so that demanding nodes will be poped first.
if !lnode.saturated && rnode.saturated {
Expand Down

0 comments on commit d2cdc4c

Please sign in to comment.