@Override
 public String getFromHistory(String jobId) throws IOException {
   Configuration conf = getConf();
   String file = getHistoryFile(conf, jobId);
   if (file == null) return null;
   JobHistory.JobInfo jobInfo = new JobHistory.JobInfo(jobId);
   DefaultJobHistoryParser.parseJobTasks(file, jobInfo, new Path(file).getFileSystem(conf));
   LOG.info("History file: {}", file);
   LOG.debug("Number of tasks in the history file: {}", jobInfo.getAllTasks().size());
   for (JobHistory.Task task : jobInfo.getAllTasks().values()) {
     if (task.get(JobHistory.Keys.TASK_TYPE).equals(JobHistory.Values.MAP.name())
         && task.get(JobHistory.Keys.TASK_STATUS).equals(JobHistory.Values.SUCCESS.name())) {
       for (JobHistory.TaskAttempt attempt : task.getTaskAttempts().values()) {
         if (attempt.get(JobHistory.Keys.TASK_STATUS).equals(JobHistory.Values.SUCCESS.name())) {
           return JobHistory.getTaskLogsUrl(attempt);
         }
       }
     }
   }
   LOG.warn("Unable to find successful map task attempt");
   return null;
 }