if (!status.getHealthStatus().isNodeHealthy()) {
/** */ public TaskTrackerStatus(String trackerName, String host, int httpPort, List<TaskStatus> taskReports, int failures, int maxMapTasks, int maxReduceTasks) { this.trackerName = trackerName; this.host = host; this.httpPort = httpPort; this.taskReports = new ArrayList<TaskStatus>(taskReports); this.failures = failures; this.maxMapTasks = maxMapTasks; this.maxReduceTasks = maxReduceTasks; this.resStatus = new ResourceStatus(); this.healthStatus = new TaskTrackerHealthStatus(); }
private TaskTrackerHealthStatus getUnhealthyNodeStatus(String error) { TaskTrackerHealthStatus status = new TaskTrackerHealthStatus(); status.setNodeHealthy(false); status.setLastReported(System.currentTimeMillis()); status.setHealthReport(error); return status; }
healthChecker.setHealthStatus(healthStatus); } else { healthStatus.setNodeHealthy(true); healthStatus.setLastReported(0L); healthStatus.setHealthReport("");
TaskTrackerStatus tt = (TaskTrackerStatus) it.next(); long sinceHeartbeat = System.currentTimeMillis() - tt.getLastSeen(); boolean isHealthy = tt.getHealthStatus().isNodeHealthy(); long sinceHealthCheck = tt.getHealthStatus().getLastReported(); String healthString = ""; if(sinceHealthCheck == 0) {
healthChecker.setHealthStatus(healthStatus); } else { healthStatus.setNodeHealthy(true); healthStatus.setLastReported(0L); healthStatus.setHealthReport("");
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\""; .isNodeHealthy()); assertTrue("Node health status reported unhealthy", healthStatus .getHealthReport().isEmpty()); LOG.info("Checking Healthy--->Unhealthy"); assertFalse("Node health status reported healthy", healthStatus .isNodeHealthy()); assertFalse("Node health status reported healthy", healthStatus .getHealthReport().isEmpty()); .isNodeHealthy()); assertTrue("Node health status reported unhealthy", healthStatus .getHealthReport().isEmpty()); 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);
@Override public void run() { if (MesosTracker.this.active) { // If the tracker activated while we were awaiting to acquire the // lock, start the periodic cleanup timer and return. schedulePeriodic(); return; } // When the scheduler is busy or doesn't receive offers, it may // fail to mark some TaskTrackers as active even though they are. // Here we do a final check with the JobTracker to make sure this // TaskTracker is really not there before we kill it. final Collection<TaskTrackerStatus> taskTrackers = MesosTracker.this.scheduler.jobTracker.taskTrackers(); for (TaskTrackerStatus status : taskTrackers) { HttpHost host = new HttpHost(status.getHost(), status.getHttpPort()); if (status.getHealthStatus().isNodeHealthy() && MesosTracker.this.host.equals(host)) { schedulePeriodic(); return; } } if (MesosTracker.this.scheduler.metrics != null) { MesosTracker.this.scheduler.metrics.launchTimeout.mark(); } LOG.warn("Tracker " + MesosTracker.this.host + " failed to launch within " + MesosScheduler.LAUNCH_TIMEOUT_MS / 1000 + " seconds, killing it"); MesosTracker.this.scheduler.killTracker(MesosTracker.this); } }, MesosScheduler.LAUNCH_TIMEOUT_MS, TimeUnit.MILLISECONDS);
jobTracker.getFaultReport(hosts[i]).replace("\n", "")); status.setNodeHealthy(false); status.setLastReported(System.currentTimeMillis()); status.setHealthReport(error1); sendHeartBeat(status, false); checkReasonForBlackListing(hosts[0], nodeUnHealthyReasonSet);
public void readFields(DataInput in) throws IOException { this.trackerName = Text.readString(in); this.host = Text.readString(in); this.httpPort = in.readInt(); this.failures = in.readInt(); this.maxMapTasks = in.readInt(); this.maxReduceTasks = in.readInt(); resStatus.readFields(in); taskReports.clear(); int numTasks = in.readInt(); for (int i = 0; i < numTasks; i++) { taskReports.add(TaskStatus.readTaskStatus(in)); } getHealthStatus().readFields(in); } }
public void readFields(DataInput in) throws IOException { this.trackerName = Text.readString(in); this.host = Text.readString(in); this.httpPort = in.readInt(); this.failures = in.readInt(); this.maxMapTasks = in.readInt(); this.maxReduceTasks = in.readInt(); resStatus.readFields(in); taskReports.clear(); int numTasks = in.readInt(); for (int i = 0; i < numTasks; i++) { taskReports.add(TaskStatus.readTaskStatus(in)); } getHealthStatus().readFields(in); }
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()); }
/** */ public TaskTrackerStatus(String trackerName, String host, int httpPort, List<TaskStatus> taskReports, int failures, int maxMapTasks, int maxReduceTasks) { this.trackerName = trackerName; this.host = host; this.httpPort = httpPort; this.taskReports = new ArrayList<TaskStatus>(taskReports); this.failures = failures; this.maxMapTasks = maxMapTasks; this.maxReduceTasks = maxReduceTasks; this.resStatus = new ResourceStatus(); this.healthStatus = new TaskTrackerHealthStatus(); }
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++; }
public void write(DataOutput out) throws IOException { Text.writeString(out, trackerName); Text.writeString(out, host); out.writeInt(httpPort); out.writeInt(failures); out.writeInt(maxMapTasks); out.writeInt(maxReduceTasks); resStatus.write(out); out.writeInt(taskReports.size()); for (TaskStatus taskStatus : taskReports) { TaskStatus.writeTaskStatus(out, taskStatus); } getHealthStatus().write(out); }
public void write(DataOutput out) throws IOException { Text.writeString(out, trackerName); Text.writeString(out, host); out.writeInt(httpPort); out.writeInt(failures); out.writeInt(maxMapTasks); out.writeInt(maxReduceTasks); resStatus.write(out); out.writeInt(taskReports.size()); for (TaskStatus taskStatus : taskReports) { TaskStatus.writeTaskStatus(out, taskStatus); } getHealthStatus().write(out); }
/** */ public TaskTrackerStatus() { taskReports = new ArrayList<TaskStatus>(); resStatus = new ResourceStatus(); this.healthStatus = new TaskTrackerHealthStatus(); }
/** * 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()); }
private void updateNodeHealthStatus(TaskTrackerStatus trackerStatus) { TaskTrackerHealthStatus status = trackerStatus.getHealthStatus(); synchronized (faultyTrackers) { faultyTrackers.setNodeHealthStatus(trackerStatus.getHost(), status.isNodeHealthy(), status.getHealthReport()); } }
private void updateNodeHealthStatus(TaskTrackerStatus trackerStatus) { TaskTrackerHealthStatus status = trackerStatus.getHealthStatus(); synchronized (faultyTrackers) { faultyTrackers.setNodeHealthStatus(trackerStatus.getHost(), status.isNodeHealthy(), status.getHealthReport()); } }