/**
   * Renders the response JSON for attemptsInfo API
   * The JSON will have an array of attempt objects under the key attempts.
   */
public void getAttemptsInfo() {
    if (!setupResponse()) {
      return;
    }
    DAG dag = checkAndGetDAGFromRequest();
    if (dag == null) {
      return;
    }
    int limit = MAX_QUERIED;
    try {
      limit = getQueryParamInt(WebUIService.LIMIT);
    } catch (NumberFormatException e) {
      //Ignore
    }
    List<TaskAttempt> attempts = getRequestedAttempts(dag, limit);
    if(attempts == null) {
      return;
    }
    Map<String, Set<String>> counterNames = getCounterListFromRequest();
    ArrayList<Map<String, Object>> attemptsInfo = new ArrayList<Map<String, Object>>();
    for(TaskAttempt a : attempts) {
      Map<String, Object> attemptInfo = new HashMap<String, Object>();
      attemptInfo.put("id", a.getID().toString());
      attemptInfo.put("progress", Float.toString(a.getProgress()));
      attemptInfo.put("status", a.getState().toString());
      try {
        TezCounters counters = a.getCounters();
        Map<String, Map<String, Long>> counterMap = constructCounterMapInfo(counters, counterNames);
        if (counterMap != null && !counterMap.isEmpty()) {
          attemptInfo.put("counters", counterMap);
        }
      } catch (LimitExceededException e) {
        // Ignore
        // TODO: add an error message instead for counter key
      }
      attemptsInfo.add(attemptInfo);
    }
    renderJSON(ImmutableMap.of("attempts", attemptsInfo));
  }
public void getAttemptsInfo() {
if (!setupResponse()) {
return;
}
DAG dag = checkAndGetDAGFromRequest();
if (dag == null) {
return;
}
int limit = MAX_QUERIED;
try {
limit = getQueryParamInt(WebUIService.LIMIT);
} catch (NumberFormatException e) {
//Ignore
}
List<TaskAttempt> attempts = getRequestedAttempts(dag, limit);
if(attempts == null) {
return;
}
Map<String, Set<String>> counterNames = getCounterListFromRequest();
ArrayList<Map<String, Object>> attemptsInfo = new ArrayList<Map<String, Object>>();
for(TaskAttempt a : attempts) {
Map<String, Object> attemptInfo = new HashMap<String, Object>();
attemptInfo.put("id", a.getID().toString());
attemptInfo.put("progress", Float.toString(a.getProgress()));
attemptInfo.put("status", a.getState().toString());
try {
TezCounters counters = a.getCounters();
Map<String, Map<String, Long>> counterMap = constructCounterMapInfo(counters, counterNames);
if (counterMap != null && !counterMap.isEmpty()) {
attemptInfo.put("counters", counterMap);
}
} catch (LimitExceededException e) {
// Ignore
// TODO: add an error message instead for counter key
}
attemptsInfo.add(attemptInfo);
}
renderJSON(ImmutableMap.of("attempts", attemptsInfo));
}
public void getAttemptsInfo() {
if (!setupResponse()) {
return;
}
DAG dag = checkAndGetDAGFromRequest();
if (dag == null) {
return;
}
int limit = MAX_QUERIED;
try {
limit = getQueryParamInt(WebUIService.LIMIT);
} catch (NumberFormatException e) {
//Ignore
}
List<TaskAttempt> attempts = getRequestedAttempts(dag, limit);
if(attempts == null) {
return;
}
Map<String, Set<String>> counterNames = getCounterListFromRequest();
ArrayList<Map<String, Object>> attemptsInfo = new ArrayList<Map<String, Object>>();
for(TaskAttempt a : attempts) {
Map<String, Object> attemptInfo = new HashMap<String, Object>();
attemptInfo.put("id", a.getID().toString());
attemptInfo.put("progress", Float.toString(a.getProgress()));
attemptInfo.put("status", a.getState().toString());
try {
TezCounters counters = a.getCounters();
Map<String, Map<String, Long>> counterMap = constructCounterMapInfo(counters, counterNames);
if (counterMap != null && !counterMap.isEmpty()) {
attemptInfo.put("counters", counterMap);
}
} catch (LimitExceededException e) {
// Ignore
// TODO: add an error message instead for counter key
}
attemptsInfo.add(attemptInfo);
}
renderJSON(ImmutableMap.of("attempts", attemptsInfo));
}
public void getAttemptsInfo() {
if (!setupResponse()) {
return;
}
DAG dag = checkAndGetDAGFromRequest();
if (dag == null) {
return;
}
int limit = MAX_QUERIED;
try {
limit = getQueryParamInt(WebUIService.LIMIT);
} catch (NumberFormatException e) {
//Ignore
}
List<TaskAttempt> attempts = getRequestedAttempts(dag, limit);
if(attempts == null) {
return;
}
Map<String, Set<String>> counterNames = getCounterListFromRequest();
ArrayList<Map<String, Object>> attemptsInfo = new ArrayList<Map<String, Object>>();
for(TaskAttempt a : attempts) {
Map<String, Object> attemptInfo = new HashMap<String, Object>();
attemptInfo.put("id", a.getID().toString());
attemptInfo.put("progress", Float.toString(a.getProgress()));
attemptInfo.put("status", a.getState().toString());
try {
TezCounters counters = a.getCounters();
Map<String, Map<String, Long>> counterMap = constructCounterMapInfo(counters, counterNames);
if (counterMap != null && !counterMap.isEmpty()) {
attemptInfo.put("counters", counterMap);
}
} catch (LimitExceededException e) {
// Ignore
// TODO: add an error message instead for counter key
}
attemptsInfo.add(attemptInfo);
}
renderJSON(ImmutableMap.of("attempts", attemptsInfo));
}