Package org.apache.hadoop.mapred.TaskTrackerStatus

Examples of org.apache.hadoop.mapred.TaskTrackerStatus.TaskTrackerHealthStatus


  }
 
  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++) {
View Full Code Here


    //clear the blacklisted trackers with node health reasons.
    sendHeartBeat(null, false);
  }
 
  private TaskTrackerHealthStatus getUnhealthyNodeStatus(String error) {
    TaskTrackerHealthStatus status = new TaskTrackerHealthStatus();
    status.setNodeHealthy(false);
    status.setLastReported(System.currentTimeMillis());
    status.setHealthReport(error);
    return status;
  }
View Full Code Here

        .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);
View Full Code Here

        .getBlackListedTrackers();

    assertTrue("The blacklisted tracker nodes is not empty.",
        blackListedTrackerInfo.isEmpty());

    TaskTrackerHealthStatus status = getUnhealthyNodeStatus(errorWithNewLines);
    // make all tracker unhealthy
    sendHeartBeat(status, false);
    assertEquals("All trackers not blacklisted", 3, jobTracker
        .getBlacklistedTrackerCount());
    // Verify the new method .getBlackListedTracker() which is
View Full Code Here

    assertTrue("Node health script should start", NodeHealthCheckerService
        .shouldRun(conf));
  }

  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);
  }
View Full Code Here

      status.getResourceStatus().setNumProcessors(numCpu);
      status.getResourceStatus().setCpuUsage(cpuUsage);
    }
    //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
    //
View Full Code Here

  }

  @Override
  public boolean isHealthy() {
    boolean healthy = true;
    TaskTrackerHealthStatus hs = new TaskTrackerHealthStatus();
    if (healthChecker != null) {
      healthChecker.setHealthStatus(hs);
      healthy = hs.isNodeHealthy();
    }   
    return healthy;
  }
View Full Code Here

      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
    //
View Full Code Here

      status.getResourceStatus().setReduceSlotMemorySizeOnTT(
          reduceSlotSizeMemoryOnTT);
    }
    //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
    //
View Full Code Here

  }

  @Override
  public boolean isHealthy() {
    boolean healthy = true;
    TaskTrackerHealthStatus hs = new TaskTrackerHealthStatus();
    if (healthChecker != null) {
      healthChecker.setHealthStatus(hs);
      healthy = hs.isNodeHealthy();
    }   
    return healthy;
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.mapred.TaskTrackerStatus.TaskTrackerHealthStatus

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.