YARN-4628. Display application priority in yarn top. Contributed by Bibin A Chundatt.
(cherry picked from commit 663a80031c
)
This commit is contained in:
parent
0c9110d15e
commit
05b57c87f9
|
@ -67,6 +67,9 @@ Release 2.9.0 - UNRELEASED
|
||||||
YARN-4307. Display blacklisted nodes for AM container in the RM web UI.
|
YARN-4307. Display blacklisted nodes for AM container in the RM web UI.
|
||||||
(Naganarasimha G R via vvasudev)
|
(Naganarasimha G R via vvasudev)
|
||||||
|
|
||||||
|
YARN-4628. Display application priority in yarn top.
|
||||||
|
(Bibin A Chundatt via vvasudev)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
|
|
|
@ -55,6 +55,7 @@ import org.apache.hadoop.util.Time;
|
||||||
import org.apache.hadoop.util.ToolRunner;
|
import org.apache.hadoop.util.ToolRunner;
|
||||||
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsRequest;
|
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsRequest;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationReport;
|
import org.apache.hadoop.yarn.api.records.ApplicationReport;
|
||||||
|
import org.apache.hadoop.yarn.api.records.Priority;
|
||||||
import org.apache.hadoop.yarn.api.records.QueueInfo;
|
import org.apache.hadoop.yarn.api.records.QueueInfo;
|
||||||
import org.apache.hadoop.yarn.api.records.QueueStatistics;
|
import org.apache.hadoop.yarn.api.records.QueueStatistics;
|
||||||
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
|
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
|
||||||
|
@ -141,7 +142,9 @@ public class TopCLI extends YarnCLI {
|
||||||
displayStringsMap.put(Columns.NAME, name);
|
displayStringsMap.put(Columns.NAME, name);
|
||||||
queue = appReport.getQueue();
|
queue = appReport.getQueue();
|
||||||
displayStringsMap.put(Columns.QUEUE, queue);
|
displayStringsMap.put(Columns.QUEUE, queue);
|
||||||
priority = 0;
|
Priority appPriority = appReport.getPriority();
|
||||||
|
priority = null != appPriority ? appPriority.getPriority() : 0;
|
||||||
|
displayStringsMap.put(Columns.PRIORITY, String.valueOf(priority));
|
||||||
usedContainers =
|
usedContainers =
|
||||||
appReport.getApplicationResourceUsageReport().getNumUsedContainers();
|
appReport.getApplicationResourceUsageReport().getNumUsedContainers();
|
||||||
displayStringsMap.put(Columns.CONT, String.valueOf(usedContainers));
|
displayStringsMap.put(Columns.CONT, String.valueOf(usedContainers));
|
||||||
|
@ -305,6 +308,14 @@ public class TopCLI extends YarnCLI {
|
||||||
return a1.name.compareTo(a2.name);
|
return a1.name.compareTo(a2.name);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
public static final Comparator<ApplicationInformation> AppPriorityComparator =
|
||||||
|
new Comparator<ApplicationInformation>() {
|
||||||
|
@Override
|
||||||
|
public int compare(ApplicationInformation a1,
|
||||||
|
ApplicationInformation a2) {
|
||||||
|
return a1.priority - a2.priority;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private static class NodesInformation {
|
private static class NodesInformation {
|
||||||
int totalNodes;
|
int totalNodes;
|
||||||
|
@ -620,6 +631,8 @@ public class TopCLI extends YarnCLI {
|
||||||
"%10s", true, "Application type", "t"));
|
"%10s", true, "Application type", "t"));
|
||||||
columnInformationEnumMap.put(Columns.QUEUE, new ColumnInformation("QUEUE",
|
columnInformationEnumMap.put(Columns.QUEUE, new ColumnInformation("QUEUE",
|
||||||
"%10s", true, "Application queue", "q"));
|
"%10s", true, "Application queue", "q"));
|
||||||
|
columnInformationEnumMap.put(Columns.PRIORITY, new ColumnInformation(
|
||||||
|
"PRIOR", "%5s", true, "Application priority", "l"));
|
||||||
columnInformationEnumMap.put(Columns.CONT, new ColumnInformation("#CONT",
|
columnInformationEnumMap.put(Columns.CONT, new ColumnInformation("#CONT",
|
||||||
"%7s", true, "Number of containers", "c"));
|
"%7s", true, "Number of containers", "c"));
|
||||||
columnInformationEnumMap.put(Columns.RCONT, new ColumnInformation("#RCONT",
|
columnInformationEnumMap.put(Columns.RCONT, new ColumnInformation("#RCONT",
|
||||||
|
@ -1010,6 +1023,9 @@ public class TopCLI extends YarnCLI {
|
||||||
case "n":
|
case "n":
|
||||||
comparator = AppNameComparator;
|
comparator = AppNameComparator;
|
||||||
break;
|
break;
|
||||||
|
case "l":
|
||||||
|
comparator = AppPriorityComparator;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// it wasn't a sort key
|
// it wasn't a sort key
|
||||||
currentSortField = f;
|
currentSortField = f;
|
||||||
|
|
Loading…
Reference in New Issue