Revert "YARN-4452. NPE when submit Unmanaged application. Contributed by Naganarasimha G R."

This reverts commit face83775bbfd4fd0387404461dfc963729164c1.

Conflicts:

	hadoop-yarn-project/CHANGES.txt
This commit is contained in:
Jason Lowe 2016-01-25 16:26:00 +00:00
parent 70e53cf746
commit 6cf2fa36b3
3 changed files with 10 additions and 38 deletions

View File

@ -51,9 +51,6 @@ Release 2.7.3 - UNRELEASED
YARN-4439. Clarify NMContainerStatus#toString method. (Jian He via xgong) YARN-4439. Clarify NMContainerStatus#toString method. (Jian He via xgong)
YARN-4452. NPE when submit Unmanaged application. (Naganarasimha G R
via junping_du)
YARN-4546. ResourceManager crash due to scheduling opportunity overflow. YARN-4546. ResourceManager crash due to scheduling opportunity overflow.
(Jason Lowe via junping_du) (Jason Lowe via junping_du)

View File

@ -142,8 +142,6 @@ public void appACLsUpdated(RMApp app, String appViewACLs,
public void appAttemptRegistered(RMAppAttempt appAttempt, public void appAttemptRegistered(RMAppAttempt appAttempt,
long registeredTime) { long registeredTime) {
if (publishSystemMetrics) { if (publishSystemMetrics) {
ContainerId container = (appAttempt.getMasterContainer() == null) ? null
: appAttempt.getMasterContainer().getId();
dispatcher.getEventHandler().handle( dispatcher.getEventHandler().handle(
new AppAttemptRegisteredEvent( new AppAttemptRegisteredEvent(
appAttempt.getAppAttemptId(), appAttempt.getAppAttemptId(),
@ -151,7 +149,7 @@ public void appAttemptRegistered(RMAppAttempt appAttempt,
appAttempt.getRpcPort(), appAttempt.getRpcPort(),
appAttempt.getTrackingUrl(), appAttempt.getTrackingUrl(),
appAttempt.getOriginalTrackingUrl(), appAttempt.getOriginalTrackingUrl(),
container, appAttempt.getMasterContainer().getId(),
registeredTime)); registeredTime));
} }
} }
@ -337,10 +335,9 @@ private static TimelineEntity createApplicationEntity(
event.getHost()); event.getHost());
eventInfo.put(AppAttemptMetricsConstants.RPC_PORT_EVENT_INFO, eventInfo.put(AppAttemptMetricsConstants.RPC_PORT_EVENT_INFO,
event.getRpcPort()); event.getRpcPort());
if (event.getMasterContainerId() != null) { eventInfo.put(
eventInfo.put(AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO, AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO,
event.getMasterContainerId().toString()); event.getMasterContainerId().toString());
}
tEvent.setEventInfo(eventInfo); tEvent.setEventInfo(eventInfo);
entity.addEvent(tEvent); entity.addEvent(tEvent);
putEntity(entity); putEntity(entity);

View File

@ -193,31 +193,11 @@ public void testPublishApplicationMetrics() throws Exception {
} }
} }
@Test(timeout = 10000)
public void testPublishAppAttemptMetricsForUnmanagedAM() throws Exception {
ApplicationAttemptId appAttemptId =
ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 1), 1);
RMAppAttempt appAttempt = createRMAppAttempt(appAttemptId,true);
metricsPublisher.appAttemptRegistered(appAttempt, Integer.MAX_VALUE + 1L);
RMApp app = mock(RMApp.class);
when(app.getFinalApplicationStatus()).thenReturn(FinalApplicationStatus.UNDEFINED);
metricsPublisher.appAttemptFinished(appAttempt, RMAppAttemptState.FINISHED, app,
Integer.MAX_VALUE + 2L);
TimelineEntity entity = null;
do {
entity =
store.getEntity(appAttemptId.toString(),
AppAttemptMetricsConstants.ENTITY_TYPE,
EnumSet.allOf(Field.class));
// ensure two events are both published before leaving the loop
} while (entity == null || entity.getEvents().size() < 2);
}
@Test(timeout = 10000) @Test(timeout = 10000)
public void testPublishAppAttemptMetrics() throws Exception { public void testPublishAppAttemptMetrics() throws Exception {
ApplicationAttemptId appAttemptId = ApplicationAttemptId appAttemptId =
ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 1), 1); ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 1), 1);
RMAppAttempt appAttempt = createRMAppAttempt(appAttemptId, false); RMAppAttempt appAttempt = createRMAppAttempt(appAttemptId);
metricsPublisher.appAttemptRegistered(appAttempt, Integer.MAX_VALUE + 1L); metricsPublisher.appAttemptRegistered(appAttempt, Integer.MAX_VALUE + 1L);
RMApp app = mock(RMApp.class); RMApp app = mock(RMApp.class);
when(app.getFinalApplicationStatus()).thenReturn(FinalApplicationStatus.UNDEFINED); when(app.getFinalApplicationStatus()).thenReturn(FinalApplicationStatus.UNDEFINED);
@ -376,17 +356,15 @@ private static RMApp createRMApp(ApplicationId appId) {
} }
private static RMAppAttempt createRMAppAttempt( private static RMAppAttempt createRMAppAttempt(
ApplicationAttemptId appAttemptId, boolean unmanagedAMAttempt) { ApplicationAttemptId appAttemptId) {
RMAppAttempt appAttempt = mock(RMAppAttempt.class); RMAppAttempt appAttempt = mock(RMAppAttempt.class);
when(appAttempt.getAppAttemptId()).thenReturn(appAttemptId); when(appAttempt.getAppAttemptId()).thenReturn(appAttemptId);
when(appAttempt.getHost()).thenReturn("test host"); when(appAttempt.getHost()).thenReturn("test host");
when(appAttempt.getRpcPort()).thenReturn(-100); when(appAttempt.getRpcPort()).thenReturn(-100);
if (!unmanagedAMAttempt) {
Container container = mock(Container.class); Container container = mock(Container.class);
when(container.getId()) when(container.getId())
.thenReturn(ContainerId.newContainerId(appAttemptId, 1)); .thenReturn(ContainerId.newContainerId(appAttemptId, 1));
when(appAttempt.getMasterContainer()).thenReturn(container); when(appAttempt.getMasterContainer()).thenReturn(container);
}
when(appAttempt.getDiagnostics()).thenReturn("test diagnostics info"); when(appAttempt.getDiagnostics()).thenReturn("test diagnostics info");
when(appAttempt.getTrackingUrl()).thenReturn("test tracking url"); when(appAttempt.getTrackingUrl()).thenReturn("test tracking url");
when(appAttempt.getOriginalTrackingUrl()).thenReturn( when(appAttempt.getOriginalTrackingUrl()).thenReturn(