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

Java TaskTrackerHealthStatus类代码示例

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

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



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

示例1: sendHeartBeat

import org.apache.hadoop.mapred.TaskTrackerStatus.TaskTrackerHealthStatus; //导入依赖的package包/类
private static void sendHeartBeat(TaskTrackerHealthStatus status, 
                                  boolean initialContact) 
throws IOException {
  for (String tracker : trackers) {
    TaskTrackerStatus tts = new TaskTrackerStatus(tracker, JobInProgress
        .convertTrackerNameToHostName(tracker));
    if (status != null) {
      TaskTrackerHealthStatus healthStatus = tts.getHealthStatus();
      healthStatus.setNodeHealthy(status.isNodeHealthy());
      healthStatus.setHealthReport(status.getHealthReport());
      healthStatus.setLastReported(status.getLastReported());
    }
    jobTracker.heartbeat(tts, false, initialContact, 
                         false, responseId);
  }
  responseId++;
}
 
开发者ID:rekhajoshm,项目名称:mapreduce-fork,代码行数:18,代码来源:TestTaskTrackerBlacklisting.java


示例2: testNodeHealthBlackListing

import org.apache.hadoop.mapred.TaskTrackerStatus.TaskTrackerHealthStatus; //导入依赖的package包/类
public void testNodeHealthBlackListing() throws Exception {
  TaskTrackerHealthStatus status = getUnhealthyNodeStatus("ERROR");
  //Blacklist tracker due to node health failures.
  sendHeartBeat(status, false);
  for (String host : hosts) {
    checkReasonForBlackListing(host, nodeUnHealthyReasonSet);
  }
  status.setNodeHealthy(true);
  status.setLastReported(System.currentTimeMillis());
  status.setHealthReport("");
  //white list tracker so the further test cases can be
  //using trackers.
  sendHeartBeat(status, false);
  assertEquals("Trackers still blacklisted after healthy report", 0,
      jobTracker.getBlacklistedTrackerCount());
}
 
开发者ID:rekhajoshm,项目名称:mapreduce-fork,代码行数:17,代码来源:TestTaskTrackerBlacklisting.java


示例3: updateNodeHealthStatus

import org.apache.hadoop.mapred.TaskTrackerStatus.TaskTrackerHealthStatus; //导入依赖的package包/类
private void updateNodeHealthStatus(TaskTrackerStatus trackerStatus) {
  TaskTrackerHealthStatus status = trackerStatus.getHealthStatus();
  synchronized (faultyTrackers) {
    faultyTrackers.setNodeHealthStatus(trackerStatus.getHost(), 
        status.isNodeHealthy(), status.getHealthReport());
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:8,代码来源:JobTracker.java


示例4: isHealthy

import org.apache.hadoop.mapred.TaskTrackerStatus.TaskTrackerHealthStatus; //导入依赖的package包/类
@Override
public boolean isHealthy() {
  boolean healthy = true;
  TaskTrackerHealthStatus hs = new TaskTrackerHealthStatus();
  if (healthChecker != null) {
    healthChecker.setHealthStatus(hs);
    healthy = hs.isNodeHealthy();
  }    
  return healthy;
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:11,代码来源:TaskTracker.java


示例5: updateNodeHealthStatus

import org.apache.hadoop.mapred.TaskTrackerStatus.TaskTrackerHealthStatus; //导入依赖的package包/类
private void updateNodeHealthStatus(TaskTrackerStatus trackerStatus) {
  TaskTrackerHealthStatus status = trackerStatus.getHealthStatus();
  synchronized (faultyTrackers) {
    faultyTrackers.setNodeHealthStatus(trackerStatus.getHost(),
        status.isNodeHealthy(), status.getHealthReport());
  }
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:8,代码来源:JobTracker.java


示例6: updateNodeHealthStatus

import org.apache.hadoop.mapred.TaskTrackerStatus.TaskTrackerHealthStatus; //导入依赖的package包/类
private void updateNodeHealthStatus(TaskTrackerStatus trackerStatus,
                                    long timeStamp) {
  TaskTrackerHealthStatus status = trackerStatus.getHealthStatus();
  synchronized (faultyTrackers) {
    faultyTrackers.setNodeHealthStatus(trackerStatus.getHost(), 
        status.isNodeHealthy(), status.getHealthReport(), timeStamp);
  }
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre,代码行数:9,代码来源:JobTracker.java


示例7: testBlackListingWithFailuresAndHealthStatus

import org.apache.hadoop.mapred.TaskTrackerStatus.TaskTrackerHealthStatus; //导入依赖的package包/类
public void testBlackListingWithFailuresAndHealthStatus() throws Exception {
  runBlackListingJob(jobTracker, trackers);
  assertEquals("Tracker 1 not blacklisted", 1,
      jobTracker.getBlacklistedTrackerCount());
  checkReasonForBlackListing(hosts[0], exceedsFailuresReasonSet);
  TaskTrackerHealthStatus status = getUnhealthyNodeStatus("ERROR");
  
  sendHeartBeat(status, false);

  assertEquals("All trackers not blacklisted", 3,
      jobTracker.getBlacklistedTrackerCount());
  checkReasonForBlackListing(hosts[0], unhealthyAndExceedsFailure);
  checkReasonForBlackListing(hosts[1], nodeUnHealthyReasonSet);
  checkReasonForBlackListing(hosts[2], nodeUnHealthyReasonSet);
  
  clock.jumpADay = true;
  sendHeartBeat(status, false);
  
  assertEquals("All trackers not blacklisted", 3,
      jobTracker.getBlacklistedTrackerCount());
  
  for (String host : hosts) {
    checkReasonForBlackListing(host, nodeUnHealthyReasonSet);
  }
  //clear blacklisted trackers due to node health reasons.
  sendHeartBeat(null, false);
  
  assertEquals("All trackers not white listed", 0,
      jobTracker.getBlacklistedTrackerCount());
  //Clear the blacklisted trackers due to failures.
  clock.jumpADay = false;
}
 
开发者ID:rekhajoshm,项目名称:mapreduce-fork,代码行数:33,代码来源:TestTaskTrackerBlacklisting.java


示例8: testBlacklistingReasonString

import org.apache.hadoop.mapred.TaskTrackerStatus.TaskTrackerHealthStatus; //导入依赖的package包/类
public void testBlacklistingReasonString() throws Exception {
  String error = "ERROR";
  String error1 = "ERROR1";
  TaskTrackerHealthStatus status = getUnhealthyNodeStatus(error);
  sendHeartBeat(status, false);

  assertEquals("All trackers not blacklisted", 3,
      jobTracker.getBlacklistedTrackerCount());

  checkReasonForBlackListing(hosts[0], nodeUnHealthyReasonSet);
  checkReasonForBlackListing(hosts[1], nodeUnHealthyReasonSet);
  checkReasonForBlackListing(hosts[2], nodeUnHealthyReasonSet);
  for (int i = 0; i < hosts.length; i++) {
    //Replace new line as we are adding new line
    //in getFaultReport
    assertEquals("Blacklisting reason string not correct for host " + i,
        error,
        jobTracker.getFaultReport(hosts[i]).replace("\n", ""));
  }
  status.setNodeHealthy(false);
  status.setLastReported(System.currentTimeMillis());
  status.setHealthReport(error1);
  sendHeartBeat(status, false);
  checkReasonForBlackListing(hosts[0], nodeUnHealthyReasonSet);
  checkReasonForBlackListing(hosts[1], nodeUnHealthyReasonSet);
  checkReasonForBlackListing(hosts[2], nodeUnHealthyReasonSet);
  for (int i = 0; i < hosts.length; i++) {
    //Replace new line as we are adding new line
    //in getFaultReport
    assertEquals("Blacklisting reason string not correct for host " + i,
        error1,
        jobTracker.getFaultReport(hosts[i]).replace("\n", ""));
  }
  //clear the blacklisted trackers with node health reasons.
  sendHeartBeat(null, false);
}
 
开发者ID:rekhajoshm,项目名称:mapreduce-fork,代码行数:37,代码来源:TestTaskTrackerBlacklisting.java


示例9: getUnhealthyNodeStatus

import org.apache.hadoop.mapred.TaskTrackerStatus.TaskTrackerHealthStatus; //导入依赖的package包/类
private TaskTrackerHealthStatus getUnhealthyNodeStatus(String error) {
  TaskTrackerHealthStatus status = new TaskTrackerHealthStatus();
  status.setNodeHealthy(false);
  status.setLastReported(System.currentTimeMillis());
  status.setHealthReport(error);
  return status;
}
 
开发者ID:rekhajoshm,项目名称:mapreduce-fork,代码行数:8,代码来源:TestTaskTrackerBlacklisting.java


示例10: setHealthStatus

import org.apache.hadoop.mapred.TaskTrackerStatus.TaskTrackerHealthStatus; //导入依赖的package包/类
/**
 * Method to populate the fields for the {@link TaskTrackerHealthStatus}
 * 
 * @param healthStatus
 */
synchronized void setHealthStatus(TaskTrackerHealthStatus healthStatus) {
  healthStatus.setNodeHealthy(this.isHealthy());
  healthStatus.setHealthReport(this.getHealthReport());
  healthStatus.setLastReported(this.getLastReportedTime());
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:11,代码来源:NodeHealthCheckerService.java


示例11: testNodeHealthScript

import org.apache.hadoop.mapred.TaskTrackerStatus.TaskTrackerHealthStatus; //导入依赖的package包/类
public void testNodeHealthScript() throws Exception {
  TaskTrackerHealthStatus healthStatus = new TaskTrackerHealthStatus();
  String errorScript = "echo ERROR\n echo \"Tracker not healthy\"";
  String normalScript = "echo \"I am all fine\"";
  String timeOutScript = "sleep 4\n echo\"I am fine\"";
  Configuration conf = getConfForNodeHealthScript();
  conf.writeXml(new FileOutputStream(nodeHealthConfigFile));

  NodeHealthCheckerService nodeHealthChecker = new NodeHealthCheckerService(
      conf);
  TimerTask timer = nodeHealthChecker.getTimer();
  writeNodeHealthScriptFile(normalScript, true);
  timer.run();

  nodeHealthChecker.setHealthStatus(healthStatus);
  LOG.info("Checking initial healthy condition");
  // Check proper report conditions.
  assertTrue("Node health status reported unhealthy", healthStatus
      .isNodeHealthy());
  assertTrue("Node health status reported unhealthy", healthStatus
      .getHealthReport().isEmpty());

  // write out error file.
  // Healthy to unhealthy transition
  writeNodeHealthScriptFile(errorScript, true);
  // Run timer
  timer.run();
  // update health status
  nodeHealthChecker.setHealthStatus(healthStatus);
  LOG.info("Checking Healthy--->Unhealthy");
  assertFalse("Node health status reported healthy", healthStatus
      .isNodeHealthy());
  assertFalse("Node health status reported healthy", healthStatus
      .getHealthReport().isEmpty());
  
  // Check unhealthy to healthy transitions.
  writeNodeHealthScriptFile(normalScript, true);
  timer.run();
  nodeHealthChecker.setHealthStatus(healthStatus);
  LOG.info("Checking UnHealthy--->healthy");
  // Check proper report conditions.
  assertTrue("Node health status reported unhealthy", healthStatus
      .isNodeHealthy());
  assertTrue("Node health status reported unhealthy", healthStatus
      .getHealthReport().isEmpty());

  // Healthy to timeout transition.
  writeNodeHealthScriptFile(timeOutScript, true);
  timer.run();
  nodeHealthChecker.setHealthStatus(healthStatus);
  LOG.info("Checking Healthy--->timeout");
  assertFalse("Node health status reported healthy even after timeout",
      healthStatus.isNodeHealthy());
  assertEquals("Node time out message not propogated", healthStatus
      .getHealthReport(),
      NodeHealthCheckerService.NODE_HEALTH_SCRIPT_TIMED_OUT_MSG);
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:58,代码来源:TestNodeHealthService.java


示例12: transmitHeartBeat

import org.apache.hadoop.mapred.TaskTrackerStatus.TaskTrackerHealthStatus; //导入依赖的package包/类
/**
 * Build and transmit the heart beat to the JobTracker
 * @param jobClient The jobTracker RPC handle
 * @param heartbeatResponseId Last heartbeat response received
 * @param status TaskTrackerStatus to transmit
 * @return false if the tracker was unknown
 * @throws IOException
 */
protected HeartbeatResponse transmitHeartBeat(
    InterTrackerProtocol jobClient, short heartbeatResponseId,
    TaskTrackerStatus status) throws IOException {
  //
  // Check if we should ask for a new Task
  //
  boolean askForNewTask;
  long localMinSpaceStart;
  synchronized (this) {
    askForNewTask =
      ((status.countOccupiedMapSlots() < maxMapSlots ||
        status.countOccupiedReduceSlots() < maxReduceSlots) &&
       acceptNewTasks);
    localMinSpaceStart = minSpaceStart;
  }
  if (askForNewTask) {
    checkLocalDirs(fConf.getLocalDirs());
    askForNewTask = enoughFreeSpace(localMinSpaceStart);
    gatherResourceStatus(status);
  }
  //add node health information

  TaskTrackerHealthStatus healthStatus = status.getHealthStatus();
  synchronized (this) {
    if (healthChecker != null) {
      healthChecker.setHealthStatus(healthStatus);
    } else {
      healthStatus.setNodeHealthy(true);
      healthStatus.setLastReported(0L);
      healthStatus.setHealthReport("");
    }
  }
  //
  // Xmit the heartbeat
  //
  HeartbeatResponse heartbeatResponse = jobClient.heartbeat(status,
                                                            justStarted,
                                                            justInited,
                                                            askForNewTask,
                                                            heartbeatResponseId);

  synchronized (this) {
    for (TaskStatus taskStatus : status.getTaskReports()) {
      if (taskStatus.getRunState() != TaskStatus.State.RUNNING &&
          taskStatus.getRunState() != TaskStatus.State.UNASSIGNED &&
          taskStatus.getRunState() != TaskStatus.State.COMMIT_PENDING &&
          !taskStatus.inTaskCleanupPhase()) {
        if (taskStatus.getIsMap()) {
          mapTotal--;
        } else {
          reduceTotal--;
        }
        try {
          myInstrumentation.completeTask(taskStatus.getTaskID());
        } catch (MetricsException me) {
          LOG.warn("Caught: " + StringUtils.stringifyException(me));
        }
        removeRunningTask(taskStatus.getTaskID());
      }
    }

    // Clear transient status information which should only
    // be sent once to the JobTracker
    for (TaskInProgress tip: runningTasks.values()) {
      tip.getStatus().clearStatus();
    }
  }

  return heartbeatResponse;
}
 
开发者ID:iVCE,项目名称:RDFS,代码行数:79,代码来源:TaskTracker.java


示例13: testBlackListingWithTrackerReservation

import org.apache.hadoop.mapred.TaskTrackerStatus.TaskTrackerHealthStatus; //导入依赖的package包/类
public void testBlackListingWithTrackerReservation() throws Exception {
  JobConf conf = new JobConf();
  conf.setNumMapTasks(1);
  conf.setNumReduceTasks(1);
  FakeJobInProgress job = new FakeJobInProgress(conf, jobTracker);
  TaskTracker tt1 = jobTracker.getTaskTracker(trackers[0]);
  TaskTracker tt2 = jobTracker.getTaskTracker(trackers[1]);
  tt1.reserveSlots(TaskType.MAP, job, 1);
  tt1.reserveSlots(TaskType.REDUCE, job, 1);
  tt2.reserveSlots(TaskType.MAP, job, 1);
  tt2.reserveSlots(TaskType.REDUCE, job, 1);
  assertEquals("Tracker 1 not reserved for the job 1", 2, job
      .getNumReservedTaskTrackersForMaps());
  assertEquals("Tracker 1 not reserved for the job 1", 2, job
      .getNumReservedTaskTrackersForReduces());
  runBlackListingJob(jobTracker, trackers);
  assertEquals("Tracker 1 not unreserved for the job 1", 1, job
      .getNumReservedTaskTrackersForMaps());
  assertEquals("Tracker 1 not unreserved for the job 1", 1, job
      .getNumReservedTaskTrackersForReduces());
  assertEquals("Tracker 1 not blacklisted", 1, jobTracker
      .getBlacklistedTrackerCount());
  checkReasonForBlackListing(hosts[0], exceedsFailuresReasonSet);
  
  TaskTrackerHealthStatus status = getUnhealthyNodeStatus("ERROR");
  sendHeartBeat(status, false);
  assertEquals("All trackers not blacklisted", 3,
      jobTracker.getBlacklistedTrackerCount());
  
  checkReasonForBlackListing(hosts[0], unhealthyAndExceedsFailure);
  checkReasonForBlackListing(hosts[1], nodeUnHealthyReasonSet);
  checkReasonForBlackListing(hosts[2], nodeUnHealthyReasonSet);
  
  assertEquals("Tracker 1 not unreserved for the job 1", 0, job
      .getNumReservedTaskTrackersForMaps());
  assertEquals("Tracker 1 not unreserved for the job 1", 0, job
      .getNumReservedTaskTrackersForReduces());
  //white list all trackers for health reasons and failure counts
  clock.jumpADay = true;
  sendHeartBeat(null, false);
}
 
开发者ID:rekhajoshm,项目名称:mapreduce-fork,代码行数:42,代码来源:TestTaskTrackerBlacklisting.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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