if (metrics.size() == 0) {
return;
}
System.out.println("== Tasks ordered by " + heading + " ==");
PaddedTable table = new PaddedTable();
table
.addColumnTitle("Type")
.addColumnTitle("TaskId")
.addColumnTitle("Status")
.addColumnTitle("Host")
.addColumnTitle("ExecutionTime");
if(isReduce) {
table
.addColumnTitle("ShuffleTime")
.addColumnTitle("SortTime");
}
table.addColumnTitle("InputBytes")
.addColumnTitle("OutputBytes")
.addColumnTitle("InputRecords")
.addColumnTitle("OputputRecords")
.addColumnTitle("Overall Throughput (B/s)");
if(isReduce) {
table
.addColumnTitle("ShuffleThroughput")
.addColumnTitle("SortThroughput")
.addColumnTitle("ReduceThroughput");
}
Collections.sort(metrics, comparator);
Collections.reverse(metrics);
Long minVal = null;
Long maxVal = null;
long totalVals = 0;
for (TaskMetrics m : metrics) {
long v = extractLongFieldValue(m, fieldName);
minVal = minVal == null ? v : Math.min(minVal, v);
maxVal = maxVal == null ? v : Math.max(maxVal, v);
totalVals += v;
table.newRow();
table.addColumnValue(m.getType())
.addColumnValue(m.getTaskId())
.addColumnValue(m.getStatus())
.addColumnValue(m.getHost())
.addColumnValue(JobHistoryHelper.formatTime(
m.getOverallTimeMillis()));
if(isReduce) {
table.addColumnValue(JobHistoryHelper.formatTime(
m.getShuffleTimeMillis()))
.addColumnValue(JobHistoryHelper.formatTime(
m.getSortTimeMillis()));
}
table.addColumnValue(m.getInputBytes())
.addColumnValue(m.getOutputBytes())
.addColumnValue(m.getInputRecords())
.addColumnValue(m.getOutputRecords())
.addColumnValue(m.getOverallThroughputBytesPerSecond());
if(isReduce) {
table.addColumnValue(m.getShuffleThroughputBytesPerSecond())
.addColumnValue(m.getSortThroughputBytesPerSecond())
.addColumnValue(m.getReduceThroughputBytesPerSecond());
}
}