private HadoopException analyzeMRJob(String mrJobId, String rawMRJoblog) {
    // This method is called only for unsuccessful MR jobs
    HadoopException mrJobLevelException = new HadoopException();
    List<HadoopException> childExceptions = new ArrayList<HadoopException>();
    MRJobLogAnalyzer analyzedLog = new MRJobLogAnalyzer(rawMRJoblog);
    Set<String> failedMRTaskIds = analyzedLog.getFailedSubEvents();

    // sampling of tasks
    int samplingSize = SAMPLE_SIZE;
    for (String failedMRTaskId : failedMRTaskIds) {
      if(samplingSize<=0) {
        break;
      }
      String rawMRTaskLog = _mrClient.getMRTaskLog(mrJobId, failedMRTaskId);
      HadoopException mrTaskLevelException = analyzeMRTask(failedMRTaskId, rawMRTaskLog);
      childExceptions.add(mrTaskLevelException);

      samplingSize--;
    }

    mrJobLevelException.setChildExceptions(childExceptions);
    mrJobLevelException.setLoggingEvent(analyzedLog.getException());
    mrJobLevelException.setType(HadoopException.HadoopExceptionType.MRJOB);
    mrJobLevelException.setId(mrJobId);
    return mrJobLevelException;
  }
Given a failed MR Job id and diagnostics of the job, this method analyzes it and returns a HadoopException object which captures all the exception in the given MR Job.
@param mrJobId Mapreduce job id
@param rawMRJoblog Diagnostics of the mapreduce job in a string
@return HadoopException object which captures all the exceptions in the given Mapreduce job
app/com/linkedin/drelephant/exceptions/ExceptionFinder.java