Skip to content

Commit

Permalink
Adjust the sortByResourceRate sorting from large to small. (#4914)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjgllgh authored Sep 25, 2023
1 parent 89a653d commit 02a7403
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ private Comparator<Node> sortByResourceRate() {
RMNode nodeBRm = (RMNode) nodeB;
if (nodeARm.getNodeResource() == null
|| nodeARm.getNodeResource().getLeftResource() == null) {
return -1;
return 1;
} else if (nodeBRm.getNodeResource() == null
|| nodeBRm.getNodeResource().getLeftResource() == null) {
return 1;
return -1;
} else {
float aRate =
ResourceUtils.getLoadInstanceResourceRate(
Expand All @@ -106,7 +106,7 @@ private Comparator<Node> sortByResourceRate() {
ResourceUtils.getLoadInstanceResourceRate(
nodeBRm.getNodeResource().getLeftResource(),
nodeBRm.getNodeResource().getMaxResource());
return Float.compare(aRate, bRate);
return -Float.compare(aRate, bRate);
}
} catch (Throwable t) {
logger.warn("Failed to Compare resource " + t.getMessage());
Expand Down

0 comments on commit 02a7403

Please sign in to comment.