YARN-4452. NPE when submit Unmanaged application. Contributed by Naganarasimha G R.
(cherry picked from commit 50bd067e1d63d4c80dc1e7bf4024bfaf42cf4416) Conflicts: hadoop-yarn-project/CHANGES.txt
This commit is contained in:
parent
6cf2fa36b3
commit
7d046dd375
@ -51,6 +51,9 @@ Release 2.7.3 - UNRELEASED
|
||||
|
||||
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.
|
||||
(Jason Lowe via junping_du)
|
||||
|
||||
@ -949,6 +952,9 @@ Release 2.6.4 - UNRELEASED
|
||||
|
||||
BUG FIXES
|
||||
|
||||
YARN-4452. NPE when submit Unmanaged application. (Naganarasimha G R
|
||||
via junping_du)
|
||||
|
||||
YARN-4414. Nodemanager connection errors are retried at multiple levels
|
||||
(Chang Li via jlowe)
|
||||
|
||||
|
@ -142,6 +142,8 @@ public void appACLsUpdated(RMApp app, String appViewACLs,
|
||||
public void appAttemptRegistered(RMAppAttempt appAttempt,
|
||||
long registeredTime) {
|
||||
if (publishSystemMetrics) {
|
||||
ContainerId container = (appAttempt.getMasterContainer() == null) ? null
|
||||
: appAttempt.getMasterContainer().getId();
|
||||
dispatcher.getEventHandler().handle(
|
||||
new AppAttemptRegisteredEvent(
|
||||
appAttempt.getAppAttemptId(),
|
||||
@ -149,7 +151,7 @@ public void appAttemptRegistered(RMAppAttempt appAttempt,
|
||||
appAttempt.getRpcPort(),
|
||||
appAttempt.getTrackingUrl(),
|
||||
appAttempt.getOriginalTrackingUrl(),
|
||||
appAttempt.getMasterContainer().getId(),
|
||||
container,
|
||||
registeredTime));
|
||||
}
|
||||
}
|
||||
@ -335,9 +337,10 @@ private static TimelineEntity createApplicationEntity(
|
||||
event.getHost());
|
||||
eventInfo.put(AppAttemptMetricsConstants.RPC_PORT_EVENT_INFO,
|
||||
event.getRpcPort());
|
||||
eventInfo.put(
|
||||
AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO,
|
||||
event.getMasterContainerId().toString());
|
||||
if (event.getMasterContainerId() != null) {
|
||||
eventInfo.put(AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO,
|
||||
event.getMasterContainerId().toString());
|
||||
}
|
||||
tEvent.setEventInfo(eventInfo);
|
||||
entity.addEvent(tEvent);
|
||||
putEntity(entity);
|
||||
@ -362,9 +365,10 @@ private void publishAppAttemptFinishedEvent(AppAttemptFinishedEvent event) {
|
||||
event.getFinalApplicationStatus().toString());
|
||||
eventInfo.put(AppAttemptMetricsConstants.STATE_EVENT_INFO,
|
||||
event.getYarnApplicationAttemptState().toString());
|
||||
eventInfo.put(
|
||||
AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO,
|
||||
event.getMasterContainerId().toString());
|
||||
if (event.getMasterContainerId() != null) {
|
||||
eventInfo.put(AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO,
|
||||
event.getMasterContainerId().toString());
|
||||
}
|
||||
tEvent.setEventInfo(eventInfo);
|
||||
entity.addEvent(tEvent);
|
||||
putEntity(entity);
|
||||
|
@ -193,11 +193,31 @@ 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)
|
||||
public void testPublishAppAttemptMetrics() throws Exception {
|
||||
ApplicationAttemptId appAttemptId =
|
||||
ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 1), 1);
|
||||
RMAppAttempt appAttempt = createRMAppAttempt(appAttemptId);
|
||||
RMAppAttempt appAttempt = createRMAppAttempt(appAttemptId, false);
|
||||
metricsPublisher.appAttemptRegistered(appAttempt, Integer.MAX_VALUE + 1L);
|
||||
RMApp app = mock(RMApp.class);
|
||||
when(app.getFinalApplicationStatus()).thenReturn(FinalApplicationStatus.UNDEFINED);
|
||||
@ -356,15 +376,17 @@ private static RMApp createRMApp(ApplicationId appId) {
|
||||
}
|
||||
|
||||
private static RMAppAttempt createRMAppAttempt(
|
||||
ApplicationAttemptId appAttemptId) {
|
||||
ApplicationAttemptId appAttemptId, boolean unmanagedAMAttempt) {
|
||||
RMAppAttempt appAttempt = mock(RMAppAttempt.class);
|
||||
when(appAttempt.getAppAttemptId()).thenReturn(appAttemptId);
|
||||
when(appAttempt.getHost()).thenReturn("test host");
|
||||
when(appAttempt.getRpcPort()).thenReturn(-100);
|
||||
Container container = mock(Container.class);
|
||||
when(container.getId())
|
||||
.thenReturn(ContainerId.newContainerId(appAttemptId, 1));
|
||||
when(appAttempt.getMasterContainer()).thenReturn(container);
|
||||
if (!unmanagedAMAttempt) {
|
||||
Container container = mock(Container.class);
|
||||
when(container.getId())
|
||||
.thenReturn(ContainerId.newContainerId(appAttemptId, 1));
|
||||
when(appAttempt.getMasterContainer()).thenReturn(container);
|
||||
}
|
||||
when(appAttempt.getDiagnostics()).thenReturn("test diagnostics info");
|
||||
when(appAttempt.getTrackingUrl()).thenReturn("test tracking url");
|
||||
when(appAttempt.getOriginalTrackingUrl()).thenReturn(
|
||||
|
Loading…
x
Reference in New Issue
Block a user