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

Java TaskAttemptKillEvent类代码示例

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

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



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

示例1: transition

import org.apache.hadoop.mapreduce.v2.app.job.event.TaskAttemptKillEvent; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void transition(TaskAttemptImpl taskAttempt, 
    TaskAttemptEvent event) {
  // unregister it to TaskAttemptListener so that it stops listening
  // for it
  taskAttempt.taskAttemptListener.unregister(
      taskAttempt.attemptId, taskAttempt.jvmID);

  if (event instanceof TaskAttemptKillEvent) {
    taskAttempt.addDiagnosticInfo(
        ((TaskAttemptKillEvent) event).getMessage());
  }

  taskAttempt.reportedStatus.progress = 1.0f;
  taskAttempt.updateProgressSplits();
  //send the cleanup event to containerLauncher
  taskAttempt.eventHandler.handle(new ContainerLauncherEvent(
      taskAttempt.attemptId, 
      taskAttempt.container.getId(), StringInterner
          .weakIntern(taskAttempt.container.getNodeId().toString()),
      taskAttempt.container.getContainerToken(),
      ContainerLauncher.EventType.CONTAINER_REMOTE_CLEANUP));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:TaskAttemptImpl.java


示例2: actOnUnusableNode

import org.apache.hadoop.mapreduce.v2.app.job.event.TaskAttemptKillEvent; //导入依赖的package包/类
private void actOnUnusableNode(NodeId nodeId, NodeState nodeState) {
  // rerun previously successful map tasks
  List<TaskAttemptId> taskAttemptIdList = nodesToSucceededTaskAttempts.get(nodeId);
  if(taskAttemptIdList != null) {
    String mesg = "TaskAttempt killed because it ran on unusable node "
        + nodeId;
    for(TaskAttemptId id : taskAttemptIdList) {
      if(TaskType.MAP == id.getTaskId().getTaskType()) {
        // reschedule only map tasks because their outputs maybe unusable
        LOG.info(mesg + ". AttemptId:" + id);
        eventHandler.handle(new TaskAttemptKillEvent(id, mesg));
      }
    }
  }
  // currently running task attempts on unusable nodes are handled in
  // RMContainerAllocator
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:JobImpl.java


示例3: transition

import org.apache.hadoop.mapreduce.v2.app.job.event.TaskAttemptKillEvent; //导入依赖的package包/类
@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!"));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:TaskImpl.java


示例4: preemptReduce

import org.apache.hadoop.mapreduce.v2.app.job.event.TaskAttemptKillEvent; //导入依赖的package包/类
@SuppressWarnings("unchecked")
void preemptReduce(int toPreempt) {
  List<TaskAttemptId> reduceList = new ArrayList<TaskAttemptId>
    (reduces.keySet());
  //sort reduces on progress
  Collections.sort(reduceList,
      new Comparator<TaskAttemptId>() {
    @Override
    public int compare(TaskAttemptId o1, TaskAttemptId o2) {
      return Float.compare(
          getJob().getTask(o1.getTaskId()).getAttempt(o1).getProgress(),
          getJob().getTask(o2.getTaskId()).getAttempt(o2).getProgress());
    }
  });
  
  for (int i = 0; i < toPreempt && reduceList.size() > 0; i++) {
    TaskAttemptId id = reduceList.remove(0);//remove the one on top
    LOG.info("Preempting " + id);
    preemptionWaitingReduces.add(id);
    eventHandler.handle(new TaskAttemptKillEvent(id, RAMPDOWN_DIAGNOSTIC));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:RMContainerAllocator.java


示例5: createAppContext

import org.apache.hadoop.mapreduce.v2.app.job.event.TaskAttemptKillEvent; //导入依赖的package包/类
private static AppContext createAppContext(
    ApplicationAttemptId appAttemptId, Job job) {
  AppContext context = mock(AppContext.class);
  ApplicationId appId = appAttemptId.getApplicationId();
  when(context.getApplicationID()).thenReturn(appId);
  when(context.getApplicationAttemptId()).thenReturn(appAttemptId);
  when(context.getJob(isA(JobId.class))).thenReturn(job);
  when(context.getClusterInfo()).thenReturn(
    new ClusterInfo(Resource.newInstance(10240, 1)));
  when(context.getEventHandler()).thenReturn(new EventHandler() {
    @Override
    public void handle(Event event) {
      // Only capture interesting events.
      if (event instanceof TaskAttemptContainerAssignedEvent) {
        events.add((TaskAttemptContainerAssignedEvent) event);
      } else if (event instanceof TaskAttemptKillEvent) {
        taskAttemptKillEvents.add((TaskAttemptKillEvent)event);
      } else if (event instanceof JobUpdatedNodesEvent) {
        jobUpdatedNodeEvents.add((JobUpdatedNodesEvent)event);
      } else if (event instanceof JobEvent) {
        jobEvents.add((JobEvent)event);
      }
    }
  });
  return context;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:TestRMContainerAllocator.java


示例6: actOnUnusableNode

import org.apache.hadoop.mapreduce.v2.app.job.event.TaskAttemptKillEvent; //导入依赖的package包/类
private void actOnUnusableNode(NodeId nodeId, NodeState nodeState) {
  // rerun previously successful map tasks
  // do this only if the job is still in the running state and there are
  // running reducers
  if (getInternalState() == JobStateInternal.RUNNING &&
      !allReducersComplete()) {
    List<TaskAttemptId> taskAttemptIdList =
        nodesToSucceededTaskAttempts.get(nodeId);
    if (taskAttemptIdList != null) {
      String mesg = "TaskAttempt killed because it ran on unusable node "
          + nodeId;
      for (TaskAttemptId id : taskAttemptIdList) {
        if (TaskType.MAP == id.getTaskId().getTaskType()) {
          // reschedule only map tasks because their outputs maybe unusable
          LOG.info(mesg + ". AttemptId:" + id);
          eventHandler.handle(new TaskAttemptKillEvent(id, mesg));
        }
      }
    }
  }
  // currently running task attempts on unusable nodes are handled in
  // RMContainerAllocator
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:24,代码来源:JobImpl.java


示例7: createAppContext

import org.apache.hadoop.mapreduce.v2.app.job.event.TaskAttemptKillEvent; //导入依赖的package包/类
private static AppContext createAppContext(
    ApplicationAttemptId appAttemptId, Job job) {
  AppContext context = mock(AppContext.class);
  ApplicationId appId = appAttemptId.getApplicationId();
  when(context.getApplicationID()).thenReturn(appId);
  when(context.getApplicationAttemptId()).thenReturn(appAttemptId);
  when(context.getJob(isA(JobId.class))).thenReturn(job);
  when(context.getClusterInfo()).thenReturn(
    new ClusterInfo(Resource.newInstance(10240, 1)));
  when(context.getEventHandler()).thenReturn(new EventHandler() {
    @Override
    public void handle(Event event) {
      // Only capture interesting events.
      if (event instanceof TaskAttemptContainerAssignedEvent) {
        events.add((TaskAttemptContainerAssignedEvent) event);
      } else if (event instanceof TaskAttemptKillEvent) {
        taskAttemptKillEvents.add((TaskAttemptKillEvent)event);
      } else if (event instanceof JobUpdatedNodesEvent) {
        jobUpdatedNodeEvents.add((JobUpdatedNodesEvent)event);
      }
    }
  });
  return context;
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:25,代码来源:TestRMContainerAllocator.java


示例8: preemptReduce

import org.apache.hadoop.mapreduce.v2.app.job.event.TaskAttemptKillEvent; //导入依赖的package包/类
@SuppressWarnings("unchecked")
void preemptReduce(int toPreempt) {
  List<TaskAttemptId> reduceList = new ArrayList<TaskAttemptId>
    (reduces.keySet());
  //sort reduces on progress
  Collections.sort(reduceList,
      new Comparator<TaskAttemptId>() {
    @Override
    public int compare(TaskAttemptId o1, TaskAttemptId o2) {
      return Float.compare(
          getJob().getTask(o1.getTaskId()).getAttempt(o1).getProgress(),
          getJob().getTask(o2.getTaskId()).getAttempt(o2).getProgress());
    }
  });
  
  for (int i = 0; i < toPreempt && reduceList.size() > 0; i++) {
    TaskAttemptId id = reduceList.remove(0);//remove the one on top
    LOG.info("Preempting " + id);
    preemptionWaitingReduces.add(id);                                             //record the id of preemption task
    eventHandler.handle(new TaskAttemptKillEvent(id, RAMPDOWN_DIAGNOSTIC));       //kill this task
  }
}
 
开发者ID:yncxcw,项目名称:FlexMap,代码行数:23,代码来源:RMContainerAllocator.java


示例9: transition

import org.apache.hadoop.mapreduce.v2.app.job.event.TaskAttemptKillEvent; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void transition(TaskAttemptImpl taskAttempt,
    TaskAttemptEvent event) {
  if (taskAttempt.getLaunchTime() == 0) {
    sendJHStartEventForAssignedFailTask(taskAttempt);
  }
  //set the finish time
  taskAttempt.setFinishTime();

  taskAttempt.eventHandler
      .handle(createJobCounterUpdateEventTAKilled(taskAttempt, false));
  TaskAttemptUnsuccessfulCompletionEvent tauce =
      createTaskAttemptUnsuccessfulCompletionEvent(taskAttempt,
          TaskAttemptStateInternal.KILLED);
  taskAttempt.eventHandler.handle(new JobHistoryEvent(
      taskAttempt.attemptId.getTaskId().getJobId(), tauce));

  if (event instanceof TaskAttemptKillEvent) {
    taskAttempt.addDiagnosticInfo(
        ((TaskAttemptKillEvent) event).getMessage());
  }

  taskAttempt.eventHandler.handle(new TaskTAttemptKilledEvent(
      taskAttempt.attemptId, taskAttempt.getRescheduleNextAttempt()));
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:27,代码来源:TaskAttemptImpl.java


示例10: sendContainerCleanup

import org.apache.hadoop.mapreduce.v2.app.job.event.TaskAttemptKillEvent; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static void sendContainerCleanup(TaskAttemptImpl taskAttempt,
    TaskAttemptEvent event) {
  if (event instanceof TaskAttemptKillEvent) {
    taskAttempt.addDiagnosticInfo(
        ((TaskAttemptKillEvent) event).getMessage());
  }
  //send the cleanup event to containerLauncher
  taskAttempt.eventHandler.handle(new ContainerLauncherEvent(
      taskAttempt.attemptId,
      taskAttempt.container.getId(), StringInterner
      .weakIntern(taskAttempt.container.getNodeId().toString()),
      taskAttempt.container.getContainerToken(),
      ContainerLauncher.EventType.CONTAINER_REMOTE_CLEANUP,
      event.getType() == TaskAttemptEventType.TA_TIMED_OUT));
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:17,代码来源:TaskAttemptImpl.java


示例11: actOnUnusableNode

import org.apache.hadoop.mapreduce.v2.app.job.event.TaskAttemptKillEvent; //导入依赖的package包/类
private void actOnUnusableNode(NodeId nodeId, NodeState nodeState) {
  // rerun previously successful map tasks
  // do this only if the job is still in the running state and there are
  // running reducers
  if (getInternalState() == JobStateInternal.RUNNING &&
      !allReducersComplete()) {
    List<TaskAttemptId> taskAttemptIdList =
        nodesToSucceededTaskAttempts.get(nodeId);
    if (taskAttemptIdList != null) {
      String mesg = "TaskAttempt killed because it ran on unusable node "
          + nodeId;
      for (TaskAttemptId id : taskAttemptIdList) {
        if (TaskType.MAP == id.getTaskId().getTaskType()) {
          // reschedule only map tasks because their outputs maybe unusable
          LOG.info(mesg + ". AttemptId:" + id);
          // Kill the attempt and indicate that next map attempt should be
          // rescheduled (i.e. considered as a fast fail map).
          eventHandler.handle(new TaskAttemptKillEvent(id, mesg, true));
        }
      }
    }
  }
  // currently running task attempts on unusable nodes are handled in
  // RMContainerAllocator
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:26,代码来源:JobImpl.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java RenderMinecart类代码示例发布时间:2022-05-22
下一篇:
Java CommitterJobAbortEvent类代码示例发布时间: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