private JsonNode getTaskFirstFailedAttempt(URL taskAllAttemptsUrl) throws IOException, AuthenticationException {
      JsonNode rootNode = ThreadContextMR2.readJsonNode(taskAllAttemptsUrl);
      long firstAttemptFinishTime = Long.MAX_VALUE;
      JsonNode firstAttempt = null;
      JsonNode taskAttempts = rootNode.path("entities");
      for (JsonNode taskAttempt : taskAttempts) {
        String state = taskAttempt.path("otherinfo").path("counters").path("status").getTextValue();
        if (state.equals("SUCCEEDED")) {
          continue;
        }
        long finishTime = taskAttempt.path("otherinfo").path("counters").path("endTime").getLongValue();
        if( finishTime < firstAttemptFinishTime) {
          firstAttempt = taskAttempt;
          firstAttemptFinishTime = finishTime;
        }
      }
      return firstAttempt;
    }
JSONFactory class provides functionality to parse mined job data from timeline server.
app/com/linkedin/drelephant/tez/fetchers/TezFetcher.java