YARN-4551. Address the duplication between StatusUpdateWhenHealthy and StatusUpdateWhenUnhealthy transitions. (Sunil G via kasha)
(cherry picked from commit 321072ba81
)
This commit is contained in:
parent
2ea99ee35f
commit
a1ff0b4145
|
@ -33,6 +33,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