code: public void failedTask(TaskInProgress tip, TaskAttemptID taskid, String reason,
                           TaskStatus.Phase phase, TaskStatus.State state,
                           String trackerName) {
      TaskStatus status = TaskStatus.createTaskStatus(tip.isMapTask(),
                                                      taskid,
                                                      0.0f,
                                                      tip.isMapTask() ?
                                                          numSlotsPerMap :
                                                          numSlotsPerReduce,
                                                      state,
                                                      reason,
                                                      reason,
                                                      trackerName, phase,
                                                      new Counters());
      // update the actual start-time of the attempt
      TaskStatus oldStatus = tip.getTaskStatus(taskid);
      long startTime = oldStatus == null
                       ? JobTracker.getClock().getTime()
                       : oldStatus.getStartTime();
      status.setStartTime(startTime);
      long finishTime = JobTracker.getClock().getTime();
      // update finish time only if needed, as map tasks can fail after completion
      if (tip.isMapTask() && oldStatus != null) {
        long oldFinishTime = oldStatus.getFinishTime();
        if (oldFinishTime > 0) {
          finishTime = oldFinishTime;
        }
      }
      status.setFinishTime(finishTime);
      boolean wasComplete = tip.isComplete();
      updateTaskStatus(tip, status);
      boolean isComplete = tip.isComplete();
      if (wasComplete && !isComplete) { // mark a successful tip as failed
        String taskType = getTaskType(tip);
        JobHistory.Task.logFailed(tip.getTIPId(), taskType,
                                  tip.getExecFinishTime(), reason, taskid);
      }
    }
docs: Fail a task with a given reason, but without a status object.
  
  Assuming {@link JobTracker} is locked on entry.
  
  @param tip The task's tip
  @param taskid The task id
  @param reason The reason that the task failed
  @param trackerName The task tracker the task failed on