YARN-4551. Address the duplication between StatusUpdateWhenHealthy and StatusUpdateWhenUnhealthy transitions. (Sunil G via kasha)
This commit is contained in:
parent
c722b62908
commit
321072ba81
|
@ -91,6 +91,9 @@ Release 2.9.0 - UNRELEASED
|
|||
YARN-4571. Make app id/name available to the yarn authorizer provider for
|
||||
better auditing. (Jian He via wangda)
|
||||
|
||||
YARN-4551. Address the duplication between StatusUpdateWhenHealthy and
|
||||
StatusUpdateWhenUnhealthy transitions. (Sunil G via kasha)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
BUG FIXES
|
||||
|
|
|
@ -744,6 +744,20 @@ public class RMNodeImpl implements RMNode, EventHandler<RMNodeEvent> {
|
|||
rmNode.totalCapability = resourceOption.getResource();
|
||||
}
|
||||
|
||||
private static NodeHealthStatus updateRMNodeFromStatusEvents(
|
||||
RMNodeImpl rmNode, RMNodeStatusEvent statusEvent) {
|
||||
// Switch the last heartbeatresponse.
|
||||
rmNode.latestNodeHeartBeatResponse = statusEvent.getLatestResponse();
|
||||
NodeHealthStatus remoteNodeHealthStatus = statusEvent.getNodeHealthStatus();
|
||||
rmNode.setHealthReport(remoteNodeHealthStatus.getHealthReport());
|
||||
rmNode.setLastHealthReportTime(remoteNodeHealthStatus
|
||||
.getLastHealthReportTime());
|
||||
rmNode.setAggregatedContainersUtilization(statusEvent
|
||||
.getAggregatedContainersUtilization());
|
||||
rmNode.setNodeUtilization(statusEvent.getNodeUtilization());
|
||||
return remoteNodeHealthStatus;
|
||||
}
|
||||
|
||||
public static class AddNodeTransition implements
|
||||
SingleArcTransition<RMNodeImpl, RMNodeEvent> {
|
||||
|
||||
|
@ -1069,17 +1083,8 @@ public class RMNodeImpl implements RMNode, EventHandler<RMNodeEvent> {
|
|||
|
||||
RMNodeStatusEvent statusEvent = (RMNodeStatusEvent) event;
|
||||
|
||||
// Switch the last heartbeatresponse.
|
||||
rmNode.latestNodeHeartBeatResponse = statusEvent.getLatestResponse();
|
||||
|
||||
NodeHealthStatus remoteNodeHealthStatus =
|
||||
statusEvent.getNodeHealthStatus();
|
||||
rmNode.setHealthReport(remoteNodeHealthStatus.getHealthReport());
|
||||
rmNode.setLastHealthReportTime(
|
||||
remoteNodeHealthStatus.getLastHealthReportTime());
|
||||
rmNode.setAggregatedContainersUtilization(
|
||||
statusEvent.getAggregatedContainersUtilization());
|
||||
rmNode.setNodeUtilization(statusEvent.getNodeUtilization());
|
||||
NodeHealthStatus remoteNodeHealthStatus = updateRMNodeFromStatusEvents(
|
||||
rmNode, statusEvent);
|
||||
NodeState initialState = rmNode.getState();
|
||||
boolean isNodeDecommissioning =
|
||||
initialState.equals(NodeState.DECOMMISSIONING);
|
||||
|
@ -1151,15 +1156,8 @@ public class RMNodeImpl implements RMNode, EventHandler<RMNodeEvent> {
|
|||
RMNodeStatusEvent statusEvent = (RMNodeStatusEvent)event;
|
||||
|
||||
// Switch the last heartbeatresponse.
|
||||
rmNode.latestNodeHeartBeatResponse = statusEvent.getLatestResponse();
|
||||
NodeHealthStatus remoteNodeHealthStatus =
|
||||
statusEvent.getNodeHealthStatus();
|
||||
rmNode.setHealthReport(remoteNodeHealthStatus.getHealthReport());
|
||||
rmNode.setLastHealthReportTime(
|
||||
remoteNodeHealthStatus.getLastHealthReportTime());
|
||||
rmNode.setAggregatedContainersUtilization(
|
||||
statusEvent.getAggregatedContainersUtilization());
|
||||
rmNode.setNodeUtilization(statusEvent.getNodeUtilization());
|
||||
NodeHealthStatus remoteNodeHealthStatus = updateRMNodeFromStatusEvents(
|
||||
rmNode, statusEvent);
|
||||
if (remoteNodeHealthStatus.getIsNodeHealthy()) {
|
||||
rmNode.context.getDispatcher().getEventHandler().handle(
|
||||
new NodeAddedSchedulerEvent(rmNode));
|
||||
|
|
Loading…
Reference in New Issue