You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ju...@apache.org on 2017/09/22 20:54:11 UTC
hadoop git commit: YARN-7118. AHS REST API can return
NullPointerException. Contributed by Billie Rinaldi.
Repository: hadoop
Updated Branches:
refs/heads/trunk b133dc570 -> 4002bf0a9
YARN-7118. AHS REST API can return NullPointerException. Contributed by Billie Rinaldi.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/4002bf0a
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/4002bf0a
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/4002bf0a
Branch: refs/heads/trunk
Commit: 4002bf0a9e7e3619a3bdcff071f0369cbf2873ad
Parents: b133dc5
Author: Junping Du <ju...@apache.org>
Authored: Fri Sep 22 13:58:09 2017 -0700
Committer: Junping Du <ju...@apache.org>
Committed: Fri Sep 22 13:58:09 2017 -0700
----------------------------------------------------------------------
...pplicationHistoryManagerOnTimelineStore.java | 16 ++++++++---
.../webapp/TestAHSWebServices.java | 28 +++++++++++++++++---
.../hadoop/yarn/server/webapp/WebServices.java | 3 ++-
3 files changed, 38 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/4002bf0a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryManagerOnTimelineStore.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryManagerOnTimelineStore.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryManagerOnTimelineStore.java
index 9600251..ecaaf1e 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryManagerOnTimelineStore.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryManagerOnTimelineStore.java
@@ -146,7 +146,11 @@ public class TestApplicationHistoryManagerOnTimelineStore {
} else if (i == 3) {
entities.addEntity(createApplicationTimelineEntity(
appId, false, false, false, false, YarnApplicationState.FINISHED,
- true));
+ true, false));
+ } else if (i == SCALE + 1) {
+ entities.addEntity(createApplicationTimelineEntity(
+ appId, false, false, false, false, YarnApplicationState.FINISHED,
+ false, true));
} else {
entities.addEntity(createApplicationTimelineEntity(
appId, false, false, false, false, YarnApplicationState.FINISHED));
@@ -497,13 +501,14 @@ public class TestApplicationHistoryManagerOnTimelineStore {
boolean wrongAppId, boolean enableUpdateEvent,
YarnApplicationState state) {
return createApplicationTimelineEntity(appId, emptyACLs, noAttemptId,
- wrongAppId, enableUpdateEvent, state, false);
+ wrongAppId, enableUpdateEvent, state, false, false);
}
private static TimelineEntity createApplicationTimelineEntity(
ApplicationId appId, boolean emptyACLs, boolean noAttemptId,
boolean wrongAppId, boolean enableUpdateEvent,
- YarnApplicationState state, boolean missingPreemptMetrics) {
+ YarnApplicationState state, boolean missingPreemptMetrics,
+ boolean missingQueue) {
TimelineEntity entity = new TimelineEntity();
entity.setEntityType(ApplicationMetricsConstants.ENTITY_TYPE);
if (wrongAppId) {
@@ -519,7 +524,10 @@ public class TestApplicationHistoryManagerOnTimelineStore {
entityInfo.put(ApplicationMetricsConstants.TYPE_ENTITY_INFO,
"test app type");
entityInfo.put(ApplicationMetricsConstants.USER_ENTITY_INFO, "user1");
- entityInfo.put(ApplicationMetricsConstants.QUEUE_ENTITY_INFO, "test queue");
+ if (!missingQueue) {
+ entityInfo.put(ApplicationMetricsConstants.QUEUE_ENTITY_INFO,
+ "test queue");
+ }
entityInfo.put(
ApplicationMetricsConstants.UNMANAGED_APPLICATION_ENTITY_INFO, "false");
entityInfo.put(ApplicationMetricsConstants.APPLICATION_PRIORITY_INFO,
http://git-wip-us.apache.org/repos/asf/hadoop/blob/4002bf0a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebServices.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebServices.java
index bca5d5c..154c68a 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebServices.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebServices.java
@@ -100,7 +100,7 @@ public class TestAHSWebServices extends JerseyTestBase {
private static ApplicationHistoryClientService historyClientService;
private static AHSWebServices ahsWebservice;
private static final String[] USERS = new String[] { "foo" , "bar" };
- private static final int MAX_APPS = 5;
+ private static final int MAX_APPS = 6;
private static Configuration conf;
private static FileSystem fs;
private static final String remoteLogRootDir = "target/logs/";
@@ -364,7 +364,27 @@ public class TestAHSWebServices extends JerseyTestBase {
JSONObject apps = json.getJSONObject("apps");
assertEquals("incorrect number of elements", 1, apps.length());
JSONArray array = apps.getJSONArray("app");
- assertEquals("incorrect number of elements", 5, array.length());
+ assertEquals("incorrect number of elements", MAX_APPS, array.length());
+ }
+
+ @Test
+ public void testQueueQuery() throws Exception {
+ WebResource r = resource();
+ ClientResponse response =
+ r.path("ws").path("v1").path("applicationhistory").path("apps")
+ .queryParam("queue", "test queue")
+ .queryParam("user.name", USERS[round])
+ .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+ assertResponseStatusCode(Status.OK, response.getStatusInfo());
+ assertEquals(MediaType.APPLICATION_JSON + "; " + JettyUtils.UTF_8,
+ response.getType().toString());
+ JSONObject json = response.getEntity(JSONObject.class);
+ assertEquals("incorrect number of elements", 1, json.length());
+ JSONObject apps = json.getJSONObject("apps");
+ assertEquals("incorrect number of elements", 1, apps.length());
+ JSONArray array = apps.getJSONArray("app");
+ assertEquals("incorrect number of elements", MAX_APPS - 1,
+ array.length());
}
@Test
@@ -414,7 +434,7 @@ public class TestAHSWebServices extends JerseyTestBase {
JSONObject appAttempts = json.getJSONObject("appAttempts");
assertEquals("incorrect number of elements", 1, appAttempts.length());
JSONArray array = appAttempts.getJSONArray("appAttempt");
- assertEquals("incorrect number of elements", 5, array.length());
+ assertEquals("incorrect number of elements", MAX_APPS, array.length());
}
@Test
@@ -471,7 +491,7 @@ public class TestAHSWebServices extends JerseyTestBase {
JSONObject containers = json.getJSONObject("containers");
assertEquals("incorrect number of elements", 1, containers.length());
JSONArray array = containers.getJSONArray("container");
- assertEquals("incorrect number of elements", 5, array.length());
+ assertEquals("incorrect number of elements", MAX_APPS, array.length());
}
@Test
http://git-wip-us.apache.org/repos/asf/hadoop/blob/4002bf0a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebServices.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebServices.java
index 6bb6c98..1399099 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebServices.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebServices.java
@@ -192,7 +192,8 @@ public class WebServices {
}
}
if (queueQuery != null && !queueQuery.isEmpty()) {
- if (!appReport.getQueue().equals(queueQuery)) {
+ if (appReport.getQueue() == null || !appReport.getQueue()
+ .equals(queueQuery)) {
continue;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org