YARN-2598 GHS should show N/A instead of null for the inaccessible information (Zhijie Shen via mayank)

This commit is contained in:
Mayank Bansal 2014-10-09 13:41:38 -07:00
parent 6cc8ec980c
commit c1a86d105e
3 changed files with 36 additions and 10 deletions

View File

@ -572,6 +572,9 @@ Release 2.6.0 - UNRELEASED
YARN-2652 Add hadoop-yarn-registry package under hadoop-yarn. (stevel) YARN-2652 Add hadoop-yarn-registry package under hadoop-yarn. (stevel)
YARN-2598 GHS should show N/A instead of null for the inaccessible information
(Zhijie Shen via mayank)
Release 2.5.1 - 2014-09-05 Release 2.5.1 - 2014-09-05
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -59,10 +59,15 @@ import org.apache.hadoop.yarn.server.timeline.TimelineReader.Field;
import org.apache.hadoop.yarn.util.ConverterUtils; import org.apache.hadoop.yarn.util.ConverterUtils;
import org.apache.hadoop.yarn.webapp.util.WebAppUtils; import org.apache.hadoop.yarn.webapp.util.WebAppUtils;
import com.google.common.annotations.VisibleForTesting;
public class ApplicationHistoryManagerOnTimelineStore extends AbstractService public class ApplicationHistoryManagerOnTimelineStore extends AbstractService
implements implements
ApplicationHistoryManager { ApplicationHistoryManager {
@VisibleForTesting
static final String UNAVAILABLE = "N/A";
private TimelineDataManager timelineDataManager; private TimelineDataManager timelineDataManager;
private ApplicationACLsManager aclsManager; private ApplicationACLsManager aclsManager;
private String serverHttpAddress; private String serverHttpAddress;
@ -508,6 +513,21 @@ public class ApplicationHistoryManagerOnTimelineStore extends AbstractService
app.appReport.setCurrentApplicationAttemptId( app.appReport.setCurrentApplicationAttemptId(
ApplicationAttemptId.newInstance(app.appReport.getApplicationId(), -1)); ApplicationAttemptId.newInstance(app.appReport.getApplicationId(), -1));
} }
if (app.appReport.getHost() == null) {
app.appReport.setHost(UNAVAILABLE);
}
if (app.appReport.getRpcPort() < 0) {
app.appReport.setRpcPort(-1);
}
if (app.appReport.getTrackingUrl() == null) {
app.appReport.setTrackingUrl(UNAVAILABLE);
}
if (app.appReport.getOriginalTrackingUrl() == null) {
app.appReport.setOriginalTrackingUrl(UNAVAILABLE);
}
if (app.appReport.getDiagnostics() == null) {
app.appReport.setDiagnostics("");
}
return app; return app;
} }

View File

@ -178,16 +178,19 @@ public class TestApplicationHistoryManagerOnTimelineStore {
callerUGI.getShortUserName().equals("user3")))) { callerUGI.getShortUserName().equals("user3")))) {
Assert.assertEquals(ApplicationAttemptId.newInstance(appId, -1), Assert.assertEquals(ApplicationAttemptId.newInstance(appId, -1),
app.getCurrentApplicationAttemptId()); app.getCurrentApplicationAttemptId());
Assert.assertEquals(null, app.getHost()); Assert.assertEquals(ApplicationHistoryManagerOnTimelineStore.UNAVAILABLE,
app.getHost());
Assert.assertEquals(-1, app.getRpcPort()); Assert.assertEquals(-1, app.getRpcPort());
Assert.assertEquals(null, app.getTrackingUrl()); Assert.assertEquals(ApplicationHistoryManagerOnTimelineStore.UNAVAILABLE,
Assert.assertEquals(null, app.getOriginalTrackingUrl()); app.getTrackingUrl());
Assert.assertEquals(null, app.getDiagnostics()); Assert.assertEquals(ApplicationHistoryManagerOnTimelineStore.UNAVAILABLE,
app.getOriginalTrackingUrl());
Assert.assertEquals("", app.getDiagnostics());
} else { } else {
Assert.assertEquals(ApplicationAttemptId.newInstance(appId, 1), Assert.assertEquals(ApplicationAttemptId.newInstance(appId, 1),
app.getCurrentApplicationAttemptId()); app.getCurrentApplicationAttemptId());
Assert.assertEquals("test host", app.getHost()); Assert.assertEquals("test host", app.getHost());
Assert.assertEquals(-100, app.getRpcPort()); Assert.assertEquals(100, app.getRpcPort());
Assert.assertEquals("test tracking url", app.getTrackingUrl()); Assert.assertEquals("test tracking url", app.getTrackingUrl());
Assert.assertEquals("test original tracking url", Assert.assertEquals("test original tracking url",
app.getOriginalTrackingUrl()); app.getOriginalTrackingUrl());
@ -236,7 +239,7 @@ public class TestApplicationHistoryManagerOnTimelineStore {
Assert.assertEquals(ContainerId.newInstance(appAttemptId, 1), Assert.assertEquals(ContainerId.newInstance(appAttemptId, 1),
appAttempt.getAMContainerId()); appAttempt.getAMContainerId());
Assert.assertEquals("test host", appAttempt.getHost()); Assert.assertEquals("test host", appAttempt.getHost());
Assert.assertEquals(-100, appAttempt.getRpcPort()); Assert.assertEquals(100, appAttempt.getRpcPort());
Assert.assertEquals("test tracking url", appAttempt.getTrackingUrl()); Assert.assertEquals("test tracking url", appAttempt.getTrackingUrl());
Assert.assertEquals("test original tracking url", Assert.assertEquals("test original tracking url",
appAttempt.getOriginalTrackingUrl()); appAttempt.getOriginalTrackingUrl());
@ -282,7 +285,7 @@ public class TestApplicationHistoryManagerOnTimelineStore {
Assert.assertEquals(Integer.MAX_VALUE + 2L, container.getFinishTime()); Assert.assertEquals(Integer.MAX_VALUE + 2L, container.getFinishTime());
Assert.assertEquals(Resource.newInstance(-1, -1), Assert.assertEquals(Resource.newInstance(-1, -1),
container.getAllocatedResource()); container.getAllocatedResource());
Assert.assertEquals(NodeId.newInstance("test host", -100), Assert.assertEquals(NodeId.newInstance("test host", 100),
container.getAssignedNode()); container.getAssignedNode());
Assert.assertEquals(Priority.UNDEFINED, container.getPriority()); Assert.assertEquals(Priority.UNDEFINED, container.getPriority());
Assert Assert
@ -290,7 +293,7 @@ public class TestApplicationHistoryManagerOnTimelineStore {
Assert.assertEquals(ContainerState.COMPLETE, container.getContainerState()); Assert.assertEquals(ContainerState.COMPLETE, container.getContainerState());
Assert.assertEquals(-1, container.getContainerExitStatus()); Assert.assertEquals(-1, container.getContainerExitStatus());
Assert.assertEquals("http://0.0.0.0:8188/applicationhistory/logs/" + Assert.assertEquals("http://0.0.0.0:8188/applicationhistory/logs/" +
"test host:-100/container_0_0001_01_000001/" "test host:100/container_0_0001_01_000001/"
+ "container_0_0001_01_000001/user1", container.getLogUrl()); + "container_0_0001_01_000001/user1", container.getLogUrl());
} }
@ -471,7 +474,7 @@ public class TestApplicationHistoryManagerOnTimelineStore {
eventInfo.put(AppAttemptMetricsConstants.ORIGINAL_TRACKING_URL_EVENT_INFO, eventInfo.put(AppAttemptMetricsConstants.ORIGINAL_TRACKING_URL_EVENT_INFO,
"test original tracking url"); "test original tracking url");
eventInfo.put(AppAttemptMetricsConstants.HOST_EVENT_INFO, "test host"); eventInfo.put(AppAttemptMetricsConstants.HOST_EVENT_INFO, "test host");
eventInfo.put(AppAttemptMetricsConstants.RPC_PORT_EVENT_INFO, -100); eventInfo.put(AppAttemptMetricsConstants.RPC_PORT_EVENT_INFO, 100);
eventInfo.put(AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO, eventInfo.put(AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO,
ContainerId.newInstance(appAttemptId, 1)); ContainerId.newInstance(appAttemptId, 1));
tEvent.setEventInfo(eventInfo); tEvent.setEventInfo(eventInfo);
@ -509,7 +512,7 @@ public class TestApplicationHistoryManagerOnTimelineStore {
entityInfo.put(ContainerMetricsConstants.ALLOCATED_VCORE_ENTITY_INFO, -1); entityInfo.put(ContainerMetricsConstants.ALLOCATED_VCORE_ENTITY_INFO, -1);
entityInfo.put(ContainerMetricsConstants.ALLOCATED_HOST_ENTITY_INFO, entityInfo.put(ContainerMetricsConstants.ALLOCATED_HOST_ENTITY_INFO,
"test host"); "test host");
entityInfo.put(ContainerMetricsConstants.ALLOCATED_PORT_ENTITY_INFO, -100); entityInfo.put(ContainerMetricsConstants.ALLOCATED_PORT_ENTITY_INFO, 100);
entityInfo entityInfo
.put(ContainerMetricsConstants.ALLOCATED_PRIORITY_ENTITY_INFO, -1); .put(ContainerMetricsConstants.ALLOCATED_PRIORITY_ENTITY_INFO, -1);
entity.setOtherInfo(entityInfo); entity.setOtherInfo(entityInfo);