本文整理汇总了Java中org.apache.hadoop.mapred.TaskTrackerStatus.TaskTrackerHealthStatus.setNodeHealthy方法的典型用法代码示例。如果您正苦于以下问题:Java TaskTrackerHealthStatus.setNodeHealthy方法的具体用法?Java TaskTrackerHealthStatus.setNodeHealthy怎么用?Java TaskTrackerHealthStatus.setNodeHealthy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.mapred.TaskTrackerStatus.TaskTrackerHealthStatus
的用法示例。
在下文中一共展示了TaskTrackerHealthStatus.setNodeHealthy方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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++;
}
示例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());
}
示例3: 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);
}
示例4: 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;
}
示例5: 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());
}
示例6: 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;
}