微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

org.apache.hadoop.mapreduce.v2.app.job.TaskStateInternal的实例源码

项目:hadoop    文件TaskImpl.java   
@Override
public void handle(TaskEvent event) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Processing " + event.getTaskID() + " of type "
        + event.getType());
  }
  try {
    writeLock.lock();
    TaskStateInternal oldState = getInternalState();
    try {
      stateMachine.doTransition(event.getType(),event);
    } catch (InvalidStateTransitonException e) {
      LOG.error("Can't handle this event at current state for "
          + this.taskId,e);
      internalError(event.getType());
    }
    if (oldState != getInternalState()) {
      LOG.info(taskId + " Task Transitioned from " + oldState + " to "
          + getInternalState());
    }

  } finally {
    writeLock.unlock();
  }
}
项目:hadoop    文件TaskImpl.java   
private static TaskFailedEvent createTaskFailedEvent(TaskImpl task,List<String> diag,TaskStateInternal taskState,TaskAttemptId taId) {
  StringBuilder errorSb = new StringBuilder();
  if (diag != null) {
    for (String d : diag) {
      errorSb.append(",").append(d);
    }
  }
  TaskFailedEvent taskFailedEvent = new TaskFailedEvent(
      TypeConverter.fromYarn(task.taskId),// Hack since getFinishTime needs isFinished to be true and that doesn't happen till after the transition.
      task.getFinishTime(taId),TypeConverter.fromYarn(task.getType()),errorSb.toString(),taskState.toString(),taId == null ? null : TypeConverter.fromYarn(taId),task.getCounters());
  return taskFailedEvent;
}
项目: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 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    文件TaskImpl.java   
@Override
public void transition(TaskImpl task,TaskEvent event) {

  if (task.historyTaskStartGenerated) {
  TaskFailedEvent taskFailedEvent = createTaskFailedEvent(task,TaskStateInternal.KILLED,null); // Todo Verify FailedAttemptId is 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(TaskStateInternal.KILLED)));
  task.metrics.endWaitingTask(task);
}
项目:hadoop    文件MRApp.java   
public void waitForInternalState(TaskImpl task,TaskStateInternal finalState) throws Exception {
  int timeoutSecs = 0;
  TaskReport report = task.getReport();
  TaskStateInternal iState = task.getInternalState();
  while (!finalState.equals(iState) && timeoutSecs++ < 20) {
    System.out.println("Task Internal State is : " + iState
        + " Waiting for Internal state : " + finalState + "   progress : "
        + report.getProgress());
    Thread.sleep(500);
    report = task.getReport();
    iState = task.getInternalState();
  }
  System.out.println("Task Internal State is : " + iState);
  Assert.assertEquals("Task Internal state is not correct (timedout)",iState);
}
项目:aliyun-oss-hadoop-fs    文件TaskImpl.java   
@Override
public void handle(TaskEvent event) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Processing " + event.getTaskID() + " of type "
        + event.getType());
  }
  try {
    writeLock.lock();
    TaskStateInternal oldState = getInternalState();
    try {
      stateMachine.doTransition(event.getType(),event);
    } catch (InvalidStateTransitionException e) {
      LOG.error("Can't handle this event at current state for "
          + this.taskId,e);
      internalError(event.getType());
    }
    if (oldState != getInternalState()) {
      LOG.info(taskId + " Task Transitioned from " + oldState + " to "
          + getInternalState());
    }

  } finally {
    writeLock.unlock();
  }
}
项目:aliyun-oss-hadoop-fs    文件TaskImpl.java   
private static TaskFailedEvent createTaskFailedEvent(TaskImpl task,task.getCounters());
  return taskFailedEvent;
}
项目:aliyun-oss-hadoop-fs    文件TaskImpl.java   
@Override
public void transition(TaskImpl task,SPEculaTION + task.successfulAttempt + " succeeded first!"));
    }
  }
  task.finished(TaskStateInternal.SUCCEEDED);
}
项目:aliyun-oss-hadoop-fs    文件TaskImpl.java   
@Override
public TaskStateInternal transition(TaskImpl task,getExternalState(finalState)));
    return finalState;
  }
  return task.getInternalState();
}
项目:aliyun-oss-hadoop-fs    文件TaskImpl.java   
@Override
public void transition(TaskImpl task,getExternalState(TaskStateInternal.KILLED)));
  task.metrics.endWaitingTask(task);
}
项目:aliyun-oss-hadoop-fs    文件MRApp.java   
public void waitForInternalState(TaskImpl task,iState);
}
项目:big-c    文件TaskImpl.java   
@Override
public void handle(TaskEvent event) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Processing " + event.getTaskID() + " of type "
        + event.getType());
  }
  try {
    writeLock.lock();
    TaskStateInternal oldState = getInternalState();
    try {
      stateMachine.doTransition(event.getType(),e);
      internalError(event.getType());
    }
    if (oldState != getInternalState()) {
      LOG.info(taskId + " Task Transitioned from " + oldState + " to "
          + getInternalState());
    }

  } finally {
    writeLock.unlock();
  }
}
项目:big-c    文件TaskImpl.java   
private static TaskFailedEvent createTaskFailedEvent(TaskImpl task,task.getCounters());
  return taskFailedEvent;
}
项目:big-c    文件TaskImpl.java   
@Override
public void transition(TaskImpl task,SPEculaTION + task.successfulAttempt + " succeeded first!"));
    }
  }
  task.finished(TaskStateInternal.SUCCEEDED);
}
项目:big-c    文件TaskImpl.java   
@Override
public TaskStateInternal transition(TaskImpl task,getExternalState(finalState)));
    return finalState;
  }
  return task.getInternalState();
}
项目:big-c    文件TaskImpl.java   
@Override
public void transition(TaskImpl task,getExternalState(TaskStateInternal.KILLED)));
  task.metrics.endWaitingTask(task);
}
项目:big-c    文件MRApp.java   
public void waitForInternalState(TaskImpl task,iState);
}
项目:hadoop-2.6.0-cdh5.4.3    文件TaskImpl.java   
@Override
public void handle(TaskEvent event) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Processing " + event.getTaskID() + " of type "
        + event.getType());
  }
  try {
    writeLock.lock();
    TaskStateInternal oldState = getInternalState();
    try {
      stateMachine.doTransition(event.getType(),e);
      internalError(event.getType());
    }
    if (oldState != getInternalState()) {
      LOG.info(taskId + " Task Transitioned from " + oldState + " to "
          + getInternalState());
    }

  } finally {
    writeLock.unlock();
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件TaskImpl.java   
private static TaskFailedEvent createTaskFailedEvent(TaskImpl task,task.getCounters());
  return taskFailedEvent;
}
项目:hadoop-2.6.0-cdh5.4.3    文件TaskImpl.java   
@Override
public void transition(TaskImpl task,SPEculaTION + task.successfulAttempt + " succeeded first!"));
    }
  }
  task.finished(TaskStateInternal.SUCCEEDED);
}
项目:hadoop-2.6.0-cdh5.4.3    文件TaskImpl.java   
@Override
public TaskStateInternal transition(TaskImpl task,getExternalState(finalState)));
    return finalState;
  }
  return task.getInternalState();
}
项目:hadoop-2.6.0-cdh5.4.3    文件TaskImpl.java   
@Override
public void transition(TaskImpl task,getExternalState(TaskStateInternal.KILLED)));
  task.metrics.endWaitingTask(task);
}
项目:hadoop-2.6.0-cdh5.4.3    文件MRApp.java   
public void waitForInternalState(TaskImpl task,iState);
}
项目:hadoop-plus    文件TaskImpl.java   
@Override
public void handle(TaskEvent event) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Processing " + event.getTaskID() + " of type "
        + event.getType());
  }
  try {
    writeLock.lock();
    TaskStateInternal oldState = getInternalState();
    try {
      stateMachine.doTransition(event.getType(),e);
      internalError(event.getType());
    }
    if (oldState != getInternalState()) {
      LOG.info(taskId + " Task Transitioned from " + oldState + " to "
          + getInternalState());
    }

  } finally {
    writeLock.unlock();
  }
}
项目:hadoop-plus    文件TaskImpl.java   
private static TaskFailedEvent createTaskFailedEvent(TaskImpl task,task.getCounters());
  return taskFailedEvent;
}
项目:hadoop-plus    文件TaskImpl.java   
@Override
public void transition(TaskImpl task,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 TaskStateInternal transition(TaskImpl task,getExternalState(finalState)));
    return finalState;
  }
  return task.getInternalState();
}
项目:hadoop-plus    文件TaskImpl.java   
@Override
public void transition(TaskImpl task,getExternalState(TaskStateInternal.KILLED)));
  task.metrics.endWaitingTask(task);
}
项目:hadoop-plus    文件MRApp.java   
public void waitForInternalState(TaskImpl task,iState);
}
项目:FlexMap    文件TaskImpl.java   
@Override
public void handle(TaskEvent event) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Processing " + event.getTaskID() + " of type "
        + event.getType());
  }
  try {
    writeLock.lock();
    TaskStateInternal oldState = getInternalState();
    try {
      stateMachine.doTransition(event.getType(),e);
      internalError(event.getType());
    }
    if (oldState != getInternalState()) {
      LOG.info(taskId + " Task Transitioned from " + oldState + " to "
          + getInternalState());
    }

  } finally {
    writeLock.unlock();
  }
}
项目:FlexMap    文件TaskImpl.java   
private static TaskFailedEvent createTaskFailedEvent(TaskImpl task,task.getCounters());
  return taskFailedEvent;
}
项目:FlexMap    文件TaskImpl.java   
private void sendTaskSucceededEvents() {
JobTaskEvent jobTaskEvent = new JobTaskEvent(taskId,TaskState.SUCCEEDED);
long    totalTime   = this.getFinishTime() - this.getLaunchTime();
long    HDFSRecords = this.getSuccessfulAttempt().getCounters().findCounter(TaskCounter.MAP_INPUT_RECORDS).getValue();
long    executionTime  = this.getSuccessfulAttempt().getEndExecutionTime() - this.getSuccessfulAttempt().getBeginExecutionTime();
double  executionSpeed = HDFSRecords*1.0 / executionTime*1.0;
double  executionRatio = 1.0*executionTime/ totalTime;
LOG.info("inform");
LOG.info("hdfsRecrds:"+HDFSRecords);
LOG.info("excutuinTime:"+executionTime);
LOG.info("totalTime:"+executionTime);
LOG.info("excutionSpeed:"+executionSpeed);
LOG.info("excutionRatio:"+executionRatio);
LOG.info("host:"+this.getSuccessfulAttempt().getNodeId().getHost());
LOG.info("/inform");
jobTaskEvent.setTaskExecutionTime((long)executionSpeed);
jobTaskEvent.setTaskExecutionRatio(executionRatio);
jobTaskEvent.setAttemptId(successfulAttempt);
   eventHandler.handle(jobTaskEvent);
   if (historyTaskStartGenerated) {
     TaskFinishedEvent tfe = createTaskFinishedEvent(this,TaskStateInternal.SUCCEEDED);
     eventHandler.handle(new JobHistoryEvent(taskId.getJobId(),tfe));
   }
 }
项目:FlexMap    文件TaskImpl.java   
@Override
public void transition(TaskImpl task,TaskAttemptCompletionEventStatus.SUCCEEDED);
  task.finishedAttempts.add(taskAttemptId);
  task.inProgressAttempts.remove(taskAttemptId);
  task.successfulAttempt = taskAttemptId;
  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);
  task.sendTaskSucceededEvents();
}
项目:FlexMap    文件TaskImpl.java   
@Override
public TaskStateInternal transition(TaskImpl task,TaskEvent event) {
  TaskAttemptId taskAttemptId =
      ((TaskTAttemptEvent) event).getTaskAttemptID();
  LOG.info("receive attempt killed from"+task.getID().toString());

  task.handleTaskAttemptCompletion(taskAttemptId,getExternalState(finalState)));
    return finalState;
  }
  return task.getInternalState();
}
项目:FlexMap    文件TaskImpl.java   
@Override
public void transition(TaskImpl task,getExternalState(TaskStateInternal.KILLED)));
  task.metrics.endWaitingTask(task);
}
项目:FlexMap    文件MRApp.java   
public void waitForInternalState(TaskImpl task,iState);
}
项目:hops    文件TaskImpl.java   
@Override
public void handle(TaskEvent event) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Processing " + event.getTaskID() + " of type "
        + event.getType());
  }
  try {
    writeLock.lock();
    TaskStateInternal oldState = getInternalState();
    try {
      stateMachine.doTransition(event.getType(),e);
      internalError(event.getType());
    }
    if (oldState != getInternalState()) {
      LOG.info(taskId + " Task Transitioned from " + oldState + " to "
          + getInternalState());
    }

  } finally {
    writeLock.unlock();
  }
}
项目:hops    文件TaskImpl.java   
private static TaskFailedEvent createTaskFailedEvent(TaskImpl task,task.getCounters());
  return taskFailedEvent;
}
项目:hops    文件TaskImpl.java   
@Override
public void transition(TaskImpl task,SPEculaTION + task.successfulAttempt + " succeeded first!"));
    }
  }
  task.finished(TaskStateInternal.SUCCEEDED);
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。