Java 类org.apache.hadoop.mapreduce.v2.app.job.event.TaskTAttemptEvent 实例源码

项目:hadoop    文件:TaskAttemptImpl.java   
@SuppressWarnings("unchecked")
 @Override
 public void transition(TaskAttemptImpl taskAttempt, 
     TaskAttemptEvent event) {
   //set the finish time
   taskAttempt.setFinishTime();
   taskAttempt.eventHandler.handle(
       createJobCounterUpdateEventTASucceeded(taskAttempt));
   taskAttempt.logAttemptFinishedEvent(TaskAttemptStateInternal.SUCCEEDED);
   taskAttempt.eventHandler.handle(new TaskTAttemptEvent(
       taskAttempt.attemptId,
       TaskEventType.T_ATTEMPT_SUCCEEDED));
   taskAttempt.eventHandler.handle
   (new SpeculatorEvent
       (taskAttempt.reportedStatus, taskAttempt.clock.getTime()));
}
项目:hadoop    文件:TaskAttemptImpl.java   
@SuppressWarnings("unchecked")
@Override
public void transition(TaskAttemptImpl taskAttempt, TaskAttemptEvent event) {
  // set the finish time
  taskAttempt.setFinishTime();

  if (taskAttempt.getLaunchTime() != 0) {
    taskAttempt.eventHandler
        .handle(createJobCounterUpdateEventTAFailed(taskAttempt, false));
    TaskAttemptUnsuccessfulCompletionEvent tauce =
        createTaskAttemptUnsuccessfulCompletionEvent(taskAttempt,
            TaskAttemptStateInternal.FAILED);
    taskAttempt.eventHandler.handle(new JobHistoryEvent(
        taskAttempt.attemptId.getTaskId().getJobId(), tauce));
    // taskAttempt.logAttemptFinishedEvent(TaskAttemptStateInternal.FAILED); Not
    // handling failed map/reduce events.
  }else {
    LOG.debug("Not generating HistoryFinish event since start event not " +
        "generated for taskAttempt: " + taskAttempt.getID());
  }
  taskAttempt.eventHandler.handle(new TaskTAttemptEvent(
      taskAttempt.attemptId, TaskEventType.T_ATTEMPT_FAILED));
}
项目:hadoop    文件:TaskAttemptImpl.java   
@SuppressWarnings("unchecked")
@Override
public void transition(TaskAttemptImpl taskAttempt, TaskAttemptEvent event) {
  // too many fetch failure can only happen for map tasks
  Preconditions
      .checkArgument(taskAttempt.getID().getTaskId().getTaskType() == TaskType.MAP);
  //add to diagnostic
  taskAttempt.addDiagnosticInfo("Too Many fetch failures.Failing the attempt");

  if (taskAttempt.getLaunchTime() != 0) {
    taskAttempt.eventHandler
        .handle(createJobCounterUpdateEventTAFailed(taskAttempt, true));
    TaskAttemptUnsuccessfulCompletionEvent tauce =
        createTaskAttemptUnsuccessfulCompletionEvent(taskAttempt,
            TaskAttemptStateInternal.FAILED);
    taskAttempt.eventHandler.handle(new JobHistoryEvent(
        taskAttempt.attemptId.getTaskId().getJobId(), tauce));
  }else {
    LOG.debug("Not generating HistoryFinish event since start event not " +
        "generated for taskAttempt: " + taskAttempt.getID());
  }
  taskAttempt.eventHandler.handle(new TaskTAttemptEvent(
      taskAttempt.attemptId, TaskEventType.T_ATTEMPT_FAILED));
}
项目:hadoop    文件:TaskImpl.java   
@Override
public void transition(TaskImpl task, TaskEvent event) {
  TaskTAttemptEvent ev = (TaskTAttemptEvent) event;
  // The nextAttemptNumber is commit pending, decide on set the commitAttempt
  TaskAttemptId attemptID = ev.getTaskAttemptID();
  if (task.commitAttempt == null) {
    // TODO: validate attemptID
    task.commitAttempt = attemptID;
    LOG.info(attemptID + " given a go for committing the task output.");
  } else {
    // Don't think this can be a pluggable decision, so simply raise an
    // event for the TaskAttempt to delete its output.
    LOG.info(task.commitAttempt
        + " already given a go for committing the task output, so killing "
        + attemptID);
    task.eventHandler.handle(new TaskAttemptKillEvent(attemptID,
        SPECULATION + task.commitAttempt + " committed first!"));
  }
}
项目:hadoop    文件:TaskImpl.java   
@Override
public void transition(TaskImpl task, TaskEvent event) {
  TaskTAttemptEvent taskTAttemptEvent = (TaskTAttemptEvent) event;
  TaskAttemptId taskAttemptId = taskTAttemptEvent.getTaskAttemptID();
  task.handleTaskAttemptCompletion(
      taskAttemptId, 
      TaskAttemptCompletionEventStatus.SUCCEEDED);
  task.finishedAttempts.add(taskAttemptId);
  task.inProgressAttempts.remove(taskAttemptId);
  task.successfulAttempt = taskAttemptId;
  task.sendTaskSucceededEvents();
  for (TaskAttempt attempt : task.attempts.values()) {
    if (attempt.getID() != task.successfulAttempt &&
        // This is okay because it can only talk us out of sending a
        //  TA_KILL message to an attempt that doesn't need one for
        //  other reasons.
        !attempt.isFinished()) {
      LOG.info("Issuing kill to other attempt " + attempt.getID());
      task.eventHandler.handle(new TaskAttemptKillEvent(attempt.getID(),
          SPECULATION + task.successfulAttempt + " succeeded first!"));
    }
  }
  task.finished(TaskStateInternal.SUCCEEDED);
}
项目:hadoop    文件:TaskImpl.java   
@Override
public void transition(TaskImpl task, TaskEvent event) {
  TaskAttemptId taskAttemptId =
      ((TaskTAttemptEvent) event).getTaskAttemptID();
  task.handleTaskAttemptCompletion(
      taskAttemptId, 
      TaskAttemptCompletionEventStatus.KILLED);
  task.finishedAttempts.add(taskAttemptId);
  task.inProgressAttempts.remove(taskAttemptId);
  if (task.successfulAttempt == null) {
    task.addAndScheduleAttempt(Avataar.VIRGIN);
  }
  if ((task.commitAttempt != null) && (task.commitAttempt == taskAttemptId)) {
    task.commitAttempt = null;
  }
}
项目:hadoop    文件:TaskImpl.java   
@Override
public TaskStateInternal transition(TaskImpl task, TaskEvent event) {
  TaskAttemptId taskAttemptId =
      ((TaskTAttemptEvent) event).getTaskAttemptID();
  task.handleTaskAttemptCompletion(taskAttemptId, taCompletionEventStatus);
  task.finishedAttempts.add(taskAttemptId);
  // check whether all attempts are finished
  if (task.finishedAttempts.size() == task.attempts.size()) {
    if (task.historyTaskStartGenerated) {
    TaskFailedEvent taskFailedEvent = createTaskFailedEvent(task, null,
          finalState, null); // TODO JH verify failedAttempt null
    task.eventHandler.handle(new JobHistoryEvent(task.taskId.getJobId(),
        taskFailedEvent)); 
    } else {
      LOG.debug("Not generating HistoryFinish event since start event not" +
            " generated for task: " + task.getID());
    }

    task.eventHandler.handle(
        new JobTaskEvent(task.taskId, getExternalState(finalState)));
    return finalState;
  }
  return task.getInternalState();
}
项目:aliyun-oss-hadoop-fs    文件:TaskAttemptImpl.java   
@SuppressWarnings("unchecked")
@Override
public void transition(TaskAttemptImpl taskAttempt,
    TaskAttemptEvent event) {
  taskAttempt.setFinishTime();
  taskAttempt.taskAttemptListener.unregister(
      taskAttempt.attemptId, taskAttempt.jvmID);
  taskAttempt.eventHandler.handle(new ContainerLauncherEvent(
      taskAttempt.attemptId,
      taskAttempt.getAssignedContainerID(), taskAttempt.getAssignedContainerMgrAddress(),
      taskAttempt.container.getContainerToken(),
      ContainerLauncher.EventType.CONTAINER_REMOTE_CLEANUP));
  taskAttempt.eventHandler.handle(new TaskTAttemptEvent(
      taskAttempt.attemptId,
      TaskEventType.T_ATTEMPT_KILLED));

}
项目:aliyun-oss-hadoop-fs    文件:TaskAttemptImpl.java   
@SuppressWarnings("unchecked")
private static void notifyTaskAttemptFailed(TaskAttemptImpl taskAttempt) {
  if (taskAttempt.getLaunchTime() == 0) {
    sendJHStartEventForAssignedFailTask(taskAttempt);
  }
  // set the finish time
  taskAttempt.setFinishTime();
  taskAttempt.eventHandler
      .handle(createJobCounterUpdateEventTAFailed(taskAttempt, false));
  TaskAttemptUnsuccessfulCompletionEvent tauce =
      createTaskAttemptUnsuccessfulCompletionEvent(taskAttempt,
          TaskAttemptStateInternal.FAILED);
  taskAttempt.eventHandler.handle(new JobHistoryEvent(
      taskAttempt.attemptId.getTaskId().getJobId(), tauce));

  taskAttempt.eventHandler.handle(new TaskTAttemptEvent(
      taskAttempt.attemptId, TaskEventType.T_ATTEMPT_FAILED));

}
项目:aliyun-oss-hadoop-fs    文件:TaskImpl.java   
@Override
public void transition(TaskImpl task, TaskEvent event) {
  TaskTAttemptEvent ev = (TaskTAttemptEvent) event;
  // The nextAttemptNumber is commit pending, decide on set the commitAttempt
  TaskAttemptId attemptID = ev.getTaskAttemptID();
  if (task.commitAttempt == null) {
    // TODO: validate attemptID
    task.commitAttempt = attemptID;
    LOG.info(attemptID + " given a go for committing the task output.");
  } else {
    // Don't think this can be a pluggable decision, so simply raise an
    // event for the TaskAttempt to delete its output.
    LOG.info(task.commitAttempt
        + " already given a go for committing the task output, so killing "
        + attemptID);
    task.eventHandler.handle(new TaskAttemptKillEvent(attemptID,
        SPECULATION + task.commitAttempt + " committed first!"));
  }
}
项目:aliyun-oss-hadoop-fs    文件:TaskImpl.java   
@Override
public void transition(TaskImpl task, TaskEvent event) {
  TaskTAttemptEvent taskTAttemptEvent = (TaskTAttemptEvent) event;
  TaskAttemptId taskAttemptId = taskTAttemptEvent.getTaskAttemptID();
  task.handleTaskAttemptCompletion(
      taskAttemptId, 
      TaskAttemptCompletionEventStatus.SUCCEEDED);
  task.finishedAttempts.add(taskAttemptId);
  task.inProgressAttempts.remove(taskAttemptId);
  task.successfulAttempt = taskAttemptId;
  task.sendTaskSucceededEvents();
  for (TaskAttempt attempt : task.attempts.values()) {
    if (attempt.getID() != task.successfulAttempt &&
        // This is okay because it can only talk us out of sending a
        //  TA_KILL message to an attempt that doesn't need one for
        //  other reasons.
        !attempt.isFinished()) {
      LOG.info("Issuing kill to other attempt " + attempt.getID());
      task.eventHandler.handle(new TaskAttemptKillEvent(attempt.getID(),
          SPECULATION + task.successfulAttempt + " succeeded first!"));
    }
  }
  task.finished(TaskStateInternal.SUCCEEDED);
}
项目:aliyun-oss-hadoop-fs    文件:TaskImpl.java   
@Override
public void transition(TaskImpl task, TaskEvent event) {
  TaskAttemptId taskAttemptId =
      ((TaskTAttemptEvent) event).getTaskAttemptID();
  task.handleTaskAttemptCompletion(
      taskAttemptId, 
      TaskAttemptCompletionEventStatus.KILLED);
  task.finishedAttempts.add(taskAttemptId);
  task.inProgressAttempts.remove(taskAttemptId);
  if (task.successfulAttempt == null) {
    task.addAndScheduleAttempt(Avataar.VIRGIN);
  }
  if ((task.commitAttempt != null) && (task.commitAttempt == taskAttemptId)) {
    task.commitAttempt = null;
  }
}
项目:aliyun-oss-hadoop-fs    文件:TaskImpl.java   
@Override
public TaskStateInternal transition(TaskImpl task, TaskEvent event) {
  TaskAttemptId taskAttemptId =
      ((TaskTAttemptEvent) event).getTaskAttemptID();
  task.handleTaskAttemptCompletion(taskAttemptId, taCompletionEventStatus);
  task.finishedAttempts.add(taskAttemptId);
  // check whether all attempts are finished
  if (task.finishedAttempts.size() == task.attempts.size()) {
    if (task.historyTaskStartGenerated) {
    TaskFailedEvent taskFailedEvent = createTaskFailedEvent(task, null,
          finalState, null); // TODO JH verify failedAttempt null
    task.eventHandler.handle(new JobHistoryEvent(task.taskId.getJobId(),
        taskFailedEvent)); 
    } else {
      LOG.debug("Not generating HistoryFinish event since start event not" +
            " generated for task: " + task.getID());
    }

    task.eventHandler.handle(
        new JobTaskEvent(task.taskId, getExternalState(finalState)));
    return finalState;
  }
  return task.getInternalState();
}
项目:big-c    文件:TaskAttemptImpl.java   
@SuppressWarnings("unchecked")
 @Override
 public void transition(TaskAttemptImpl taskAttempt, 
     TaskAttemptEvent event) {
   //set the finish time
   taskAttempt.setFinishTime();
   taskAttempt.eventHandler.handle(
       createJobCounterUpdateEventTASucceeded(taskAttempt));
   taskAttempt.logAttemptFinishedEvent(TaskAttemptStateInternal.SUCCEEDED);
   taskAttempt.eventHandler.handle(new TaskTAttemptEvent(
       taskAttempt.attemptId,
       TaskEventType.T_ATTEMPT_SUCCEEDED));
   taskAttempt.eventHandler.handle
   (new SpeculatorEvent
       (taskAttempt.reportedStatus, taskAttempt.clock.getTime()));
}
项目:big-c    文件:TaskAttemptImpl.java   
@SuppressWarnings("unchecked")
@Override
public void transition(TaskAttemptImpl taskAttempt, TaskAttemptEvent event) {
  // set the finish time
  taskAttempt.setFinishTime();

  if (taskAttempt.getLaunchTime() != 0) {
    taskAttempt.eventHandler
        .handle(createJobCounterUpdateEventTAFailed(taskAttempt, false));
    TaskAttemptUnsuccessfulCompletionEvent tauce =
        createTaskAttemptUnsuccessfulCompletionEvent(taskAttempt,
            TaskAttemptStateInternal.FAILED);
    taskAttempt.eventHandler.handle(new JobHistoryEvent(
        taskAttempt.attemptId.getTaskId().getJobId(), tauce));
    // taskAttempt.logAttemptFinishedEvent(TaskAttemptStateInternal.FAILED); Not
    // handling failed map/reduce events.
  }else {
    LOG.debug("Not generating HistoryFinish event since start event not " +
        "generated for taskAttempt: " + taskAttempt.getID());
  }
  taskAttempt.eventHandler.handle(new TaskTAttemptEvent(
      taskAttempt.attemptId, TaskEventType.T_ATTEMPT_FAILED));
}
项目:big-c    文件:TaskAttemptImpl.java   
@SuppressWarnings("unchecked")
@Override
public void transition(TaskAttemptImpl taskAttempt, TaskAttemptEvent event) {
  // too many fetch failure can only happen for map tasks
  Preconditions
      .checkArgument(taskAttempt.getID().getTaskId().getTaskType() == TaskType.MAP);
  //add to diagnostic
  taskAttempt.addDiagnosticInfo("Too Many fetch failures.Failing the attempt");

  if (taskAttempt.getLaunchTime() != 0) {
    taskAttempt.eventHandler
        .handle(createJobCounterUpdateEventTAFailed(taskAttempt, true));
    TaskAttemptUnsuccessfulCompletionEvent tauce =
        createTaskAttemptUnsuccessfulCompletionEvent(taskAttempt,
            TaskAttemptStateInternal.FAILED);
    taskAttempt.eventHandler.handle(new JobHistoryEvent(
        taskAttempt.attemptId.getTaskId().getJobId(), tauce));
  }else {
    LOG.debug("Not generating HistoryFinish event since start event not " +
        "generated for taskAttempt: " + taskAttempt.getID());
  }
  taskAttempt.eventHandler.handle(new TaskTAttemptEvent(
      taskAttempt.attemptId, TaskEventType.T_ATTEMPT_FAILED));
}
项目:big-c    文件:TaskImpl.java   
@Override
public void transition(TaskImpl task, TaskEvent event) {
  TaskTAttemptEvent ev = (TaskTAttemptEvent) event;
  // The nextAttemptNumber is commit pending, decide on set the commitAttempt
  TaskAttemptId attemptID = ev.getTaskAttemptID();
  if (task.commitAttempt == null) {
    // TODO: validate attemptID
    task.commitAttempt = attemptID;
    LOG.info(attemptID + " given a go for committing the task output.");
  } else {
    // Don't think this can be a pluggable decision, so simply raise an
    // event for the TaskAttempt to delete its output.
    LOG.info(task.commitAttempt
        + " already given a go for committing the task output, so killing "
        + attemptID);
    task.eventHandler.handle(new TaskAttemptKillEvent(attemptID,
        SPECULATION + task.commitAttempt + " committed first!"));
  }
}
项目:big-c    文件:TaskImpl.java   
@Override
public void transition(TaskImpl task, TaskEvent event) {
  TaskTAttemptEvent taskTAttemptEvent = (TaskTAttemptEvent) event;
  TaskAttemptId taskAttemptId = taskTAttemptEvent.getTaskAttemptID();
  task.handleTaskAttemptCompletion(
      taskAttemptId, 
      TaskAttemptCompletionEventStatus.SUCCEEDED);
  task.finishedAttempts.add(taskAttemptId);
  task.inProgressAttempts.remove(taskAttemptId);
  task.successfulAttempt = taskAttemptId;
  task.sendTaskSucceededEvents();
  for (TaskAttempt attempt : task.attempts.values()) {
    if (attempt.getID() != task.successfulAttempt &&
        // This is okay because it can only talk us out of sending a
        //  TA_KILL message to an attempt that doesn't need one for
        //  other reasons.
        !attempt.isFinished()) {
      LOG.info("Issuing kill to other attempt " + attempt.getID());
      task.eventHandler.handle(new TaskAttemptKillEvent(attempt.getID(),
          SPECULATION + task.successfulAttempt + " succeeded first!"));
    }
  }
  task.finished(TaskStateInternal.SUCCEEDED);
}
项目:big-c    文件:TaskImpl.java   
@Override
public void transition(TaskImpl task, TaskEvent event) {
  TaskAttemptId taskAttemptId =
      ((TaskTAttemptEvent) event).getTaskAttemptID();
  task.handleTaskAttemptCompletion(
      taskAttemptId, 
      TaskAttemptCompletionEventStatus.KILLED);
  task.finishedAttempts.add(taskAttemptId);
  task.inProgressAttempts.remove(taskAttemptId);
  if (task.successfulAttempt == null) {
    task.addAndScheduleAttempt(Avataar.VIRGIN);
  }
  if ((task.commitAttempt != null) && (task.commitAttempt == taskAttemptId)) {
    task.commitAttempt = null;
  }
}
项目:big-c    文件:TaskImpl.java   
@Override
public TaskStateInternal transition(TaskImpl task, TaskEvent event) {
  TaskAttemptId taskAttemptId =
      ((TaskTAttemptEvent) event).getTaskAttemptID();
  task.handleTaskAttemptCompletion(taskAttemptId, taCompletionEventStatus);
  task.finishedAttempts.add(taskAttemptId);
  // check whether all attempts are finished
  if (task.finishedAttempts.size() == task.attempts.size()) {
    if (task.historyTaskStartGenerated) {
    TaskFailedEvent taskFailedEvent = createTaskFailedEvent(task, null,
          finalState, null); // TODO JH verify failedAttempt null
    task.eventHandler.handle(new JobHistoryEvent(task.taskId.getJobId(),
        taskFailedEvent)); 
    } else {
      LOG.debug("Not generating HistoryFinish event since start event not" +
            " generated for task: " + task.getID());
    }

    task.eventHandler.handle(
        new JobTaskEvent(task.taskId, getExternalState(finalState)));
    return finalState;
  }
  return task.getInternalState();
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TaskAttemptImpl.java   
@SuppressWarnings("unchecked")
 @Override
 public void transition(TaskAttemptImpl taskAttempt, 
     TaskAttemptEvent event) {
   //set the finish time
   taskAttempt.setFinishTime();
   taskAttempt.eventHandler.handle(
       createJobCounterUpdateEventTASucceeded(taskAttempt));
   taskAttempt.logAttemptFinishedEvent(TaskAttemptStateInternal.SUCCEEDED);
   taskAttempt.eventHandler.handle(new TaskTAttemptEvent(
       taskAttempt.attemptId,
       TaskEventType.T_ATTEMPT_SUCCEEDED));
   taskAttempt.eventHandler.handle
   (new SpeculatorEvent
       (taskAttempt.reportedStatus, taskAttempt.clock.getTime()));
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TaskAttemptImpl.java   
@SuppressWarnings("unchecked")
@Override
public void transition(TaskAttemptImpl taskAttempt, TaskAttemptEvent event) {
  // set the finish time
  taskAttempt.setFinishTime();

  if (taskAttempt.getLaunchTime() != 0) {
    taskAttempt.eventHandler
        .handle(createJobCounterUpdateEventTAFailed(taskAttempt, false));
    TaskAttemptUnsuccessfulCompletionEvent tauce =
        createTaskAttemptUnsuccessfulCompletionEvent(taskAttempt,
            TaskAttemptStateInternal.FAILED);
    taskAttempt.eventHandler.handle(new JobHistoryEvent(
        taskAttempt.attemptId.getTaskId().getJobId(), tauce));
    // taskAttempt.logAttemptFinishedEvent(TaskAttemptStateInternal.FAILED); Not
    // handling failed map/reduce events.
  }else {
    LOG.debug("Not generating HistoryFinish event since start event not " +
        "generated for taskAttempt: " + taskAttempt.getID());
  }
  taskAttempt.eventHandler.handle(new TaskTAttemptEvent(
      taskAttempt.attemptId, TaskEventType.T_ATTEMPT_FAILED));
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TaskImpl.java   
@Override
public void transition(TaskImpl task, TaskEvent event) {
  TaskTAttemptEvent ev = (TaskTAttemptEvent) event;
  // The nextAttemptNumber is commit pending, decide on set the commitAttempt
  TaskAttemptId attemptID = ev.getTaskAttemptID();
  if (task.commitAttempt == null) {
    // TODO: validate attemptID
    task.commitAttempt = attemptID;
    LOG.info(attemptID + " given a go for committing the task output.");
  } else {
    // Don't think this can be a pluggable decision, so simply raise an
    // event for the TaskAttempt to delete its output.
    LOG.info(task.commitAttempt
        + " already given a go for committing the task output, so killing "
        + attemptID);
    task.eventHandler.handle(new TaskAttemptKillEvent(attemptID,
        SPECULATION + task.commitAttempt + " committed first!"));
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TaskImpl.java   
@Override
public void transition(TaskImpl task, TaskEvent event) {
  TaskTAttemptEvent taskTAttemptEvent = (TaskTAttemptEvent) event;
  TaskAttemptId taskAttemptId = taskTAttemptEvent.getTaskAttemptID();
  task.handleTaskAttemptCompletion(
      taskAttemptId, 
      TaskAttemptCompletionEventStatus.SUCCEEDED);
  task.finishedAttempts.add(taskAttemptId);
  task.inProgressAttempts.remove(taskAttemptId);
  task.successfulAttempt = taskAttemptId;
  task.sendTaskSucceededEvents();
  for (TaskAttempt attempt : task.attempts.values()) {
    if (attempt.getID() != task.successfulAttempt &&
        // This is okay because it can only talk us out of sending a
        //  TA_KILL message to an attempt that doesn't need one for
        //  other reasons.
        !attempt.isFinished()) {
      LOG.info("Issuing kill to other attempt " + attempt.getID());
      task.eventHandler.handle(new TaskAttemptKillEvent(attempt.getID(),
          SPECULATION + task.successfulAttempt + " succeeded first!"));
    }
  }
  task.finished(TaskStateInternal.SUCCEEDED);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TaskImpl.java   
@Override
public void transition(TaskImpl task, TaskEvent event) {
  TaskAttemptId taskAttemptId =
      ((TaskTAttemptEvent) event).getTaskAttemptID();
  task.handleTaskAttemptCompletion(
      taskAttemptId, 
      TaskAttemptCompletionEventStatus.KILLED);
  task.finishedAttempts.add(taskAttemptId);
  task.inProgressAttempts.remove(taskAttemptId);
  if (task.successfulAttempt == null) {
    task.addAndScheduleAttempt(Avataar.VIRGIN);
  }
  if ((task.commitAttempt != null) && (task.commitAttempt == taskAttemptId)) {
    task.commitAttempt = null;
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TaskImpl.java   
@Override
public TaskStateInternal transition(TaskImpl task, TaskEvent event) {
  TaskAttemptId taskAttemptId =
      ((TaskTAttemptEvent) event).getTaskAttemptID();
  task.handleTaskAttemptCompletion(taskAttemptId, taCompletionEventStatus);
  task.finishedAttempts.add(taskAttemptId);
  // check whether all attempts are finished
  if (task.finishedAttempts.size() == task.attempts.size()) {
    if (task.historyTaskStartGenerated) {
    TaskFailedEvent taskFailedEvent = createTaskFailedEvent(task, null,
          finalState, null); // TODO JH verify failedAttempt null
    task.eventHandler.handle(new JobHistoryEvent(task.taskId.getJobId(),
        taskFailedEvent)); 
    } else {
      LOG.debug("Not generating HistoryFinish event since start event not" +
            " generated for task: " + task.getID());
    }

    task.eventHandler.handle(
        new JobTaskEvent(task.taskId, getExternalState(finalState)));
    return finalState;
  }
  return task.getInternalState();
}
项目:hops    文件:TaskImpl.java   
@Override
public void transition(TaskImpl task, TaskEvent event) {
  TaskAttemptId taskAttemptId =
      ((TaskTAttemptEvent) event).getTaskAttemptID();
  task.handleTaskAttemptCompletion(
      taskAttemptId, 
      TaskAttemptCompletionEventStatus.KILLED);
  task.finishedAttempts.add(taskAttemptId);
  task.inProgressAttempts.remove(taskAttemptId);
  if (task.successfulAttempt == null) {
    boolean rescheduleNewAttempt = false;
    if (event instanceof TaskTAttemptKilledEvent) {
      rescheduleNewAttempt =
          ((TaskTAttemptKilledEvent)event).getRescheduleAttempt();
    }
    task.addAndScheduleAttempt(Avataar.VIRGIN, rescheduleNewAttempt);
  }
  if ((task.commitAttempt != null) && (task.commitAttempt == taskAttemptId)) {
    task.commitAttempt = null;
  }
}
项目:hops    文件:TaskImpl.java   
@Override
public TaskStateInternal transition(TaskImpl task, TaskEvent event) {
  TaskAttemptId taskAttemptId =
      ((TaskTAttemptEvent) event).getTaskAttemptID();
  task.handleTaskAttemptCompletion(taskAttemptId, taCompletionEventStatus);
  task.finishedAttempts.add(taskAttemptId);
  // check whether all attempts are finished
  if (task.finishedAttempts.size() == task.attempts.size()) {
    if (task.historyTaskStartGenerated) {
    TaskFailedEvent taskFailedEvent = createTaskFailedEvent(task, null,
          finalState, null); // TODO JH verify failedAttempt null
    task.eventHandler.handle(new JobHistoryEvent(task.taskId.getJobId(),
        taskFailedEvent)); 
    } else {
      LOG.debug("Not generating HistoryFinish event since start event not" +
            " generated for task: " + task.getID());
    }

    task.eventHandler.handle(
        new JobTaskEvent(task.taskId, getExternalState(finalState)));
    return finalState;
  }
  return task.getInternalState();
}
项目:hadoop-plus    文件:TaskAttemptImpl.java   
@SuppressWarnings("unchecked")
 @Override
 public void transition(TaskAttemptImpl taskAttempt, 
     TaskAttemptEvent event) {
   //set the finish time
   taskAttempt.setFinishTime();
   taskAttempt.eventHandler.handle(
       createJobCounterUpdateEventTASucceeded(taskAttempt));
   taskAttempt.logAttemptFinishedEvent(TaskAttemptStateInternal.SUCCEEDED);
   taskAttempt.eventHandler.handle(new TaskTAttemptEvent(
       taskAttempt.attemptId,
       TaskEventType.T_ATTEMPT_SUCCEEDED));
   taskAttempt.eventHandler.handle
   (new SpeculatorEvent
       (taskAttempt.reportedStatus, taskAttempt.clock.getTime()));
}
项目:hadoop-plus    文件:TaskAttemptImpl.java   
@SuppressWarnings("unchecked")
@Override
public void transition(TaskAttemptImpl taskAttempt, TaskAttemptEvent event) {
  // set the finish time
  taskAttempt.setFinishTime();

  if (taskAttempt.getLaunchTime() != 0) {
    taskAttempt.eventHandler
        .handle(createJobCounterUpdateEventTAFailed(taskAttempt, false));
    TaskAttemptUnsuccessfulCompletionEvent tauce =
        createTaskAttemptUnsuccessfulCompletionEvent(taskAttempt,
            TaskAttemptStateInternal.FAILED);
    taskAttempt.eventHandler.handle(new JobHistoryEvent(
        taskAttempt.attemptId.getTaskId().getJobId(), tauce));
    // taskAttempt.logAttemptFinishedEvent(TaskAttemptStateInternal.FAILED); Not
    // handling failed map/reduce events.
  }else {
    LOG.debug("Not generating HistoryFinish event since start event not " +
        "generated for taskAttempt: " + taskAttempt.getID());
  }
  taskAttempt.eventHandler.handle(new TaskTAttemptEvent(
      taskAttempt.attemptId, TaskEventType.T_ATTEMPT_FAILED));
}
项目:hadoop-plus    文件:TaskAttemptImpl.java   
@SuppressWarnings("unchecked")
@Override
public void transition(TaskAttemptImpl taskAttempt, TaskAttemptEvent event) {
  // too many fetch failure can only happen for map tasks
  Preconditions
      .checkArgument(taskAttempt.getID().getTaskId().getTaskType() == TaskType.MAP);
  //add to diagnostic
  taskAttempt.addDiagnosticInfo("Too Many fetch failures.Failing the attempt");
  //set the finish time
  taskAttempt.setFinishTime();

  if (taskAttempt.getLaunchTime() != 0) {
    taskAttempt.eventHandler
        .handle(createJobCounterUpdateEventTAFailed(taskAttempt, true));
    TaskAttemptUnsuccessfulCompletionEvent tauce =
        createTaskAttemptUnsuccessfulCompletionEvent(taskAttempt,
            TaskAttemptStateInternal.FAILED);
    taskAttempt.eventHandler.handle(new JobHistoryEvent(
        taskAttempt.attemptId.getTaskId().getJobId(), tauce));
  }else {
    LOG.debug("Not generating HistoryFinish event since start event not " +
        "generated for taskAttempt: " + taskAttempt.getID());
  }
  taskAttempt.eventHandler.handle(new TaskTAttemptEvent(
      taskAttempt.attemptId, TaskEventType.T_ATTEMPT_FAILED));
}
项目:hadoop-plus    文件:TaskImpl.java   
@Override
public void transition(TaskImpl task, TaskEvent event) {
  TaskTAttemptEvent ev = (TaskTAttemptEvent) event;
  // The nextAttemptNumber is commit pending, decide on set the commitAttempt
  TaskAttemptId attemptID = ev.getTaskAttemptID();
  if (task.commitAttempt == null) {
    // TODO: validate attemptID
    task.commitAttempt = attemptID;
    LOG.info(attemptID + " given a go for committing the task output.");
  } else {
    // Don't think this can be a pluggable decision, so simply raise an
    // event for the TaskAttempt to delete its output.
    LOG.info(task.commitAttempt
        + " already given a go for committing the task output, so killing "
        + attemptID);
    task.eventHandler.handle(new TaskAttemptEvent(
        attemptID, TaskAttemptEventType.TA_KILL));
  }
}
项目:hadoop-plus    文件:TaskImpl.java   
@Override
public void transition(TaskImpl task, TaskEvent event) {
  TaskTAttemptEvent taskTAttemptEvent = (TaskTAttemptEvent) event;
  TaskAttemptId taskAttemptId = taskTAttemptEvent.getTaskAttemptID();
  task.handleTaskAttemptCompletion(
      taskAttemptId, 
      TaskAttemptCompletionEventStatus.SUCCEEDED);
  task.finishedAttempts.add(taskAttemptId);
  task.inProgressAttempts.remove(taskAttemptId);
  task.successfulAttempt = taskAttemptId;
  task.sendTaskSucceededEvents();
  for (TaskAttempt attempt : task.attempts.values()) {
    if (attempt.getID() != task.successfulAttempt &&
        // This is okay because it can only talk us out of sending a
        //  TA_KILL message to an attempt that doesn't need one for
        //  other reasons.
        !attempt.isFinished()) {
      LOG.info("Issuing kill to other attempt " + attempt.getID());
      task.eventHandler.handle(
          new TaskAttemptEvent(attempt.getID(), 
              TaskAttemptEventType.TA_KILL));
    }
  }
  task.finished(TaskStateInternal.SUCCEEDED);
}
项目:hadoop-plus    文件:TaskImpl.java   
@Override
public void transition(TaskImpl task, TaskEvent event) {
  TaskAttemptId taskAttemptId =
      ((TaskTAttemptEvent) event).getTaskAttemptID();
  task.handleTaskAttemptCompletion(
      taskAttemptId, 
      TaskAttemptCompletionEventStatus.KILLED);
  task.finishedAttempts.add(taskAttemptId);
  task.inProgressAttempts.remove(taskAttemptId);
  if (task.successfulAttempt == null) {
    task.addAndScheduleAttempt(Avataar.VIRGIN);
  }
  if ((task.commitAttempt != null) && (task.commitAttempt == taskAttemptId)) {
    task.commitAttempt = null;
  }
}
项目:hadoop-plus    文件:TaskImpl.java   
@Override
public TaskStateInternal transition(TaskImpl task, TaskEvent event) {
  TaskAttemptId taskAttemptId =
      ((TaskTAttemptEvent) event).getTaskAttemptID();
  task.handleTaskAttemptCompletion(taskAttemptId, taCompletionEventStatus);
  task.finishedAttempts.add(taskAttemptId);
  // check whether all attempts are finished
  if (task.finishedAttempts.size() == task.attempts.size()) {
    if (task.historyTaskStartGenerated) {
    TaskFailedEvent taskFailedEvent = createTaskFailedEvent(task, null,
          finalState, null); // TODO JH verify failedAttempt null
    task.eventHandler.handle(new JobHistoryEvent(task.taskId.getJobId(),
        taskFailedEvent)); 
    } else {
      LOG.debug("Not generating HistoryFinish event since start event not" +
            " generated for task: " + task.getID());
    }

    task.eventHandler.handle(
        new JobTaskEvent(task.taskId, getExternalState(finalState)));
    return finalState;
  }
  return task.getInternalState();
}
项目:hops    文件:TestTaskImpl.java   
@Test
/**
 * Kill map attempt for succeeded map task
 * {@link TaskState#SUCCEEDED}->{@link TaskState#SCHEDULED}
 */
public void testKillAttemptForSuccessfulTask() {
  LOG.info("--- START: testKillAttemptForSuccessfulTask ---");
  mockTask = createMockTask(TaskType.MAP);
  TaskId taskId = getNewTaskID();
  scheduleTaskAttempt(taskId);
  launchTaskAttempt(getLastAttempt().getAttemptId());
  commitTaskAttempt(getLastAttempt().getAttemptId());
  mockTask.handle(new TaskTAttemptEvent(getLastAttempt().getAttemptId(),
      TaskEventType.T_ATTEMPT_SUCCEEDED));
  assertTaskSucceededState();
  mockTask.handle(
      new TaskTAttemptKilledEvent(getLastAttempt().getAttemptId(), true));
  assertEquals(TaskAttemptEventType.TA_RESCHEDULE,
      taskAttemptEventHandler.lastTaskAttemptEvent.getType());
  assertTaskScheduledState();
}
项目:FlexMap    文件:TaskAttemptImpl.java   
@SuppressWarnings("unchecked")
 @Override
 public void transition(TaskAttemptImpl taskAttempt, 
     TaskAttemptEvent event) {
   //set the finish time
   taskAttempt.setFinishTime();
   taskAttempt.eventHandler.handle(
       createJobCounterUpdateEventTASucceeded(taskAttempt));
   taskAttempt.logAttemptFinishedEvent(TaskAttemptStateInternal.SUCCEEDED);
   taskAttempt.eventHandler.handle(new TaskTAttemptEvent(
       taskAttempt.attemptId,
       TaskEventType.T_ATTEMPT_SUCCEEDED));
   taskAttempt.eventHandler.handle
   (new SpeculatorEvent
       (taskAttempt.reportedStatus, taskAttempt.clock.getTime()));
}
项目:FlexMap    文件:TaskAttemptImpl.java   
@SuppressWarnings("unchecked")
@Override
public void transition(TaskAttemptImpl taskAttempt, TaskAttemptEvent event) {
  // set the finish time
  taskAttempt.setFinishTime();

  if (taskAttempt.getLaunchTime() != 0) {
    taskAttempt.eventHandler
        .handle(createJobCounterUpdateEventTAFailed(taskAttempt, false));
    TaskAttemptUnsuccessfulCompletionEvent tauce =
        createTaskAttemptUnsuccessfulCompletionEvent(taskAttempt,
            TaskAttemptStateInternal.FAILED);
    taskAttempt.eventHandler.handle(new JobHistoryEvent(
        taskAttempt.attemptId.getTaskId().getJobId(), tauce));
    // taskAttempt.logAttemptFinishedEvent(TaskAttemptStateInternal.FAILED); Not
    // handling failed map/reduce events.
  }else {
    LOG.debug("Not generating HistoryFinish event since start event not " +
        "generated for taskAttempt: " + taskAttempt.getID());
  }
  taskAttempt.eventHandler.handle(new TaskTAttemptEvent(
      taskAttempt.attemptId, TaskEventType.T_ATTEMPT_FAILED));
}
项目:FlexMap    文件:TaskAttemptImpl.java   
@SuppressWarnings("unchecked")
@Override
public void transition(TaskAttemptImpl taskAttempt, TaskAttemptEvent event) {
  // too many fetch failure can only happen for map tasks
  Preconditions
      .checkArgument(taskAttempt.getID().getTaskId().getTaskType() == TaskType.MAP);
  //add to diagnostic
  taskAttempt.addDiagnosticInfo("Too Many fetch failures.Failing the attempt");

  if (taskAttempt.getLaunchTime() != 0) {
    taskAttempt.eventHandler
        .handle(createJobCounterUpdateEventTAFailed(taskAttempt, true));
    TaskAttemptUnsuccessfulCompletionEvent tauce =
        createTaskAttemptUnsuccessfulCompletionEvent(taskAttempt,
            TaskAttemptStateInternal.FAILED);
    taskAttempt.eventHandler.handle(new JobHistoryEvent(
        taskAttempt.attemptId.getTaskId().getJobId(), tauce));
  }else {
    LOG.debug("Not generating HistoryFinish event since start event not " +
        "generated for taskAttempt: " + taskAttempt.getID());
  }
  taskAttempt.eventHandler.handle(new TaskTAttemptEvent(
      taskAttempt.attemptId, TaskEventType.T_ATTEMPT_FAILED));
}
项目:FlexMap    文件:TaskImpl.java   
@Override
public void transition(TaskImpl task, TaskEvent event) {
  TaskTAttemptEvent ev = (TaskTAttemptEvent) event;
  // The nextAttemptNumber is commit pending, decide on set the commitAttempt
  TaskAttemptId attemptID = ev.getTaskAttemptID();
  if (task.commitAttempt == null) {
    // TODO: validate attemptID
    task.commitAttempt = attemptID;
    LOG.info(attemptID + " given a go for committing the task output.");
  } else {
    // Don't think this can be a pluggable decision, so simply raise an
    // event for the TaskAttempt to delete its output.
    LOG.info(task.commitAttempt
        + " already given a go for committing the task output, so killing "
        + attemptID);
    task.eventHandler.handle(new TaskAttemptKillEvent(attemptID,
        SPECULATION + task.commitAttempt + " committed first!"));
  }
}