• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java JobHistoryEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.hadoop.mapreduce.jobhistory.JobHistoryEvent的典型用法代码示例。如果您正苦于以下问题:Java JobHistoryEvent类的具体用法?Java JobHistoryEvent怎么用?Java JobHistoryEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



JobHistoryEvent类属于org.apache.hadoop.mapreduce.jobhistory包,在下文中一共展示了JobHistoryEvent类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: handle

import org.apache.hadoop.mapreduce.jobhistory.JobHistoryEvent; //导入依赖的package包/类
@Override
public void handle(ContainerAllocatorEvent event) {
  ContainerId cId =
      ContainerId.newContainerId(getContext().getApplicationAttemptId(),
        containerCount++);
  NodeId nodeId = NodeId.newInstance(NM_HOST, NM_PORT);
  Resource resource = Resource.newInstance(1234, 2, 2);
  ContainerTokenIdentifier containerTokenIdentifier =
      new ContainerTokenIdentifier(cId, nodeId.toString(), "user",
      resource, System.currentTimeMillis() + 10000, 42, 42,
      Priority.newInstance(0), 0);
  Token containerToken = newContainerToken(nodeId, "password".getBytes(),
        containerTokenIdentifier);
  Container container = Container.newInstance(cId, nodeId,
      NM_HOST + ":" + NM_HTTP_PORT, resource, null, containerToken);
  JobID id = TypeConverter.fromYarn(applicationId);
  JobId jobId = TypeConverter.toYarn(id);
  getContext().getEventHandler().handle(new JobHistoryEvent(jobId, 
      new NormalizedResourceEvent(
          org.apache.hadoop.mapreduce.TaskType.REDUCE,
      100)));
  getContext().getEventHandler().handle(new JobHistoryEvent(jobId, 
      new NormalizedResourceEvent(
          org.apache.hadoop.mapreduce.TaskType.MAP,
      100)));
  getContext().getEventHandler().handle(
      new TaskAttemptContainerAssignedEvent(event.getAttemptID(),
          container, null));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:30,代码来源:MRApp.java


示例2: sendLaunchedEvents

import org.apache.hadoop.mapreduce.jobhistory.JobHistoryEvent; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void sendLaunchedEvents() {
  JobCounterUpdateEvent jce = new JobCounterUpdateEvent(attemptId.getTaskId()
      .getJobId());
  jce.addCounterUpdate(attemptId.getTaskId().getTaskType() == TaskType.MAP ?
      JobCounter.TOTAL_LAUNCHED_MAPS : JobCounter.TOTAL_LAUNCHED_REDUCES, 1);
  eventHandler.handle(jce);

  LOG.info("TaskAttempt: [" + attemptId
      + "] using containerId: [" + container.getId() + " on NM: ["
      + StringInterner.weakIntern(container.getNodeId().toString()) + "]");
  TaskAttemptStartedEvent tase =
    new TaskAttemptStartedEvent(TypeConverter.fromYarn(attemptId),
        TypeConverter.fromYarn(attemptId.getTaskId().getTaskType()),
        launchTime, trackerName, httpPort, shufflePort, container.getId(),
        locality.toString(), avataar.toString());
  eventHandler.handle(
      new JobHistoryEvent(attemptId.getTaskId().getJobId(), tase));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:TaskAttemptImpl.java


示例3: transition

import org.apache.hadoop.mapreduce.jobhistory.JobHistoryEvent; //导入依赖的package包/类
@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));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:TaskAttemptImpl.java


示例4: transition

import org.apache.hadoop.mapreduce.jobhistory.JobHistoryEvent; //导入依赖的package包/类
/**
 * This transition executes in the event-dispatcher thread, though it's
 * triggered in MRAppMaster's startJobs() method.
 */
@Override
public void transition(JobImpl job, JobEvent event) {
  JobStartEvent jse = (JobStartEvent) event;
  if (jse.getRecoveredJobStartTime() != 0) {
    job.startTime = jse.getRecoveredJobStartTime();
  } else {
    job.startTime = job.clock.getTime();
  }
  JobInitedEvent jie =
    new JobInitedEvent(job.oldJobId,
         job.startTime,
         job.numMapTasks, job.numReduceTasks,
         job.getState().toString(),
         job.isUber());
  job.eventHandler.handle(new JobHistoryEvent(job.jobId, jie));
  JobInfoChangeEvent jice = new JobInfoChangeEvent(job.oldJobId,
      job.appSubmitTime, job.startTime);
  job.eventHandler.handle(new JobHistoryEvent(job.jobId, jice));
  job.metrics.runningJob(job);

  job.eventHandler.handle(new CommitterJobSetupEvent(
          job.jobId, job.jobContext));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:28,代码来源:JobImpl.java


示例5: transition

import org.apache.hadoop.mapreduce.jobhistory.JobHistoryEvent; //导入依赖的package包/类
@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();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:TaskImpl.java


示例6: notifyTaskAttemptFailed

import org.apache.hadoop.mapreduce.jobhistory.JobHistoryEvent; //导入依赖的package包/类
@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));

}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:20,代码来源:TaskAttemptImpl.java


示例7: transition

import org.apache.hadoop.mapreduce.jobhistory.JobHistoryEvent; //导入依赖的package包/类
/**
 * This transition executes in the event-dispatcher thread, though it's
 * triggered in MRAppMaster's startJobs() method.
 */
@Override
public void transition(JobImpl job, JobEvent event) {
  JobStartEvent jse = (JobStartEvent) event;
  if (jse.getRecoveredJobStartTime() != -1L) {
    job.startTime = jse.getRecoveredJobStartTime();
  } else {
    job.startTime = job.clock.getTime();
  }
  JobInitedEvent jie =
    new JobInitedEvent(job.oldJobId,
         job.startTime,
         job.numMapTasks, job.numReduceTasks,
         job.getState().toString(),
         job.isUber());
  job.eventHandler.handle(new JobHistoryEvent(job.jobId, jie));
  JobInfoChangeEvent jice = new JobInfoChangeEvent(job.oldJobId,
      job.appSubmitTime, job.startTime);
  job.eventHandler.handle(new JobHistoryEvent(job.jobId, jice));
  job.metrics.runningJob(job);

  job.eventHandler.handle(new CommitterJobSetupEvent(
          job.jobId, job.jobContext));
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:28,代码来源:JobImpl.java


示例8: transition

import org.apache.hadoop.mapreduce.jobhistory.JobHistoryEvent; //导入依赖的package包/类
@Override
public void transition(TaskImpl task, TaskEvent event) {
  
  if (task.historyTaskStartGenerated) {
  TaskFailedEvent taskFailedEvent = createTaskFailedEvent(task, null,
        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);
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:18,代码来源:TaskImpl.java


示例9: transition

import org.apache.hadoop.mapreduce.jobhistory.JobHistoryEvent; //导入依赖的package包/类
@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));
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:25,代码来源:TaskAttemptImpl.java


示例10: sendTaskSucceededEvents

import org.apache.hadoop.mapreduce.jobhistory.JobHistoryEvent; //导入依赖的package包/类
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));
   }
 }
 
开发者ID:yncxcw,项目名称:FlexMap,代码行数:26,代码来源:TaskImpl.java


示例11: transition

import org.apache.hadoop.mapreduce.jobhistory.JobHistoryEvent; //导入依赖的package包/类
@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, 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();
}
 
开发者ID:yncxcw,项目名称:FlexMap,代码行数:27,代码来源:TaskImpl.java


示例12: unsuccessfulFinish

import org.apache.hadoop.mapreduce.jobhistory.JobHistoryEvent; //导入依赖的package包/类
private void unsuccessfulFinish(JobStateInternal finalState) {
    if (finishTime == 0) setFinishTime();
    cleanupProgress = 1.0f;
    JobUnsuccessfulCompletionEvent unsuccessfulJobEvent =
        new JobUnsuccessfulCompletionEvent(oldJobId,
            finishTime,
            succeededMapTaskCount,
            succeededReduceTaskCount,
            finalState.toString(),
            diagnostics);
    eventHandler.handle(new JobHistoryEvent(jobId,
        unsuccessfulJobEvent));
    finished(finalState);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:JobImpl.java



注:本文中的org.apache.hadoop.mapreduce.jobhistory.JobHistoryEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Converter类代码示例发布时间:2022-05-22
下一篇:
Java ReferenceType类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap