SortedSet<String> keys = new TreeSet<String>(progressMap.keySet());
int idx = 0;
int maxKeys = keys.size();
for (String s : keys) {
idx++;
Progress progress = progressMap.get(s);
final int complete = progress.getSucceededTaskCount();
final int total = progress.getTotalTaskCount();
final int running = progress.getRunningTaskCount();
final int failed = progress.getFailedTaskAttemptCount();
final int pending = progress.getTotalTaskCount() - progress.getSucceededTaskCount() -
progress.getRunningTaskCount();
final int killed = progress.getKilledTaskCount();
// To get vertex status we can use DAGClient.getVertexStatus(), but it will be expensive to
// get status from AM for every refresh of the UI. Lets infer the state from task counts.
// Only if DAG is FAILED or KILLED the vertex status is fetched from AM.
VertexStatus.State vertexState = VertexStatus.State.INITIALIZING;