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 2016/03/17 17:36:20 UTC
hadoop git commit: YARN-4785. inconsistent value type of the type
field for LeafQueueInfo in response of RM REST API. (Varun Vasudev via
junping-du)
Repository: hadoop
Updated Branches:
refs/heads/branch-2.6 e17fe26c8 -> c84b32bdd
YARN-4785. inconsistent value type of the type field for LeafQueueInfo in response of RM REST API. (Varun Vasudev via junping-du)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/c84b32bd
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/c84b32bd
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/c84b32bd
Branch: refs/heads/branch-2.6
Commit: c84b32bddae3003581c5d2385945d610a0f92af8
Parents: e17fe26
Author: Junping Du <ju...@apache.org>
Authored: Thu Mar 17 09:49:09 2016 -0700
Committer: Junping Du <ju...@apache.org>
Committed: Thu Mar 17 09:49:09 2016 -0700
----------------------------------------------------------------------
hadoop-yarn-project/CHANGES.txt | 3 ++
.../webapp/dao/CapacitySchedulerInfo.java | 29 +++++++++++++++++---
.../webapp/TestRMWebServicesCapacitySched.java | 3 ++
3 files changed, 31 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c84b32bd/hadoop-yarn-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt
index e1d4fcd..bccb30d 100644
--- a/hadoop-yarn-project/CHANGES.txt
+++ b/hadoop-yarn-project/CHANGES.txt
@@ -24,6 +24,9 @@ Release 2.6.5 - UNRELEASED
YARN-4761. NMs reconnecting with changed capabilities can lead to wrong cluster
resource calculations on fair scheduler. (Sangjin Lee via zxu)
+ YARN-4785. inconsistent value type of the "type" field for LeafQueueInfo in
+ response of RM REST API. (Varun Vasudev via junping-du)
+
Release 2.6.4 - 2016-02-11
INCOMPATIBLE CHANGES
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c84b32bd/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/CapacitySchedulerInfo.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/CapacitySchedulerInfo.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/CapacitySchedulerInfo.java
index 5f32342..87d0876 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/CapacitySchedulerInfo.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/CapacitySchedulerInfo.java
@@ -27,6 +27,9 @@ import javax.xml.bind.annotation.XmlType;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CSQueue;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.LeafQueue;
+import java.util.ArrayList;
+import java.util.List;
+
@XmlRootElement(name = "capacityScheduler")
@XmlType(name = "capacityScheduler")
@XmlAccessorType(XmlAccessType.FIELD)
@@ -77,12 +80,30 @@ public class CapacitySchedulerInfo extends SchedulerInfo {
}
protected CapacitySchedulerQueueInfoList getQueues(CSQueue parent) {
- CSQueue parentQueue = parent;
- CapacitySchedulerQueueInfoList queuesInfo = new CapacitySchedulerQueueInfoList();
- for (CSQueue queue : parentQueue.getChildQueues()) {
+ CapacitySchedulerQueueInfoList queuesInfo =
+ new CapacitySchedulerQueueInfoList();
+ // JAXB marashalling leads to situation where the "type" field injected
+ // for JSON changes from string to array depending on order of printing
+ // Issue gets fixed if all the leaf queues are marshalled before the
+ // non-leaf queues. See YARN-4785 for more details.
+ List<CSQueue> childQueues = new ArrayList<CSQueue>();
+ List<CSQueue> childLeafQueues = new ArrayList<CSQueue>();
+ List<CSQueue> childNonLeafQueues = new ArrayList<CSQueue>();
+ for (CSQueue queue : parent.getChildQueues()) {
+ if (queue instanceof LeafQueue) {
+ childLeafQueues.add(queue);
+ } else {
+ childNonLeafQueues.add(queue);
+ }
+ }
+ childQueues.addAll(childLeafQueues);
+ childQueues.addAll(childNonLeafQueues);
+
+ for (CSQueue queue : childQueues) {
+
CapacitySchedulerQueueInfo info;
if (queue instanceof LeafQueue) {
- info = new CapacitySchedulerLeafQueueInfo((LeafQueue)queue);
+ info = new CapacitySchedulerLeafQueueInfo((LeafQueue) queue);
} else {
info = new CapacitySchedulerQueueInfo(queue);
info.queues = getQueues(queue);
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c84b32bd/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesCapacitySched.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesCapacitySched.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesCapacitySched.java
index 63a48bb..7d0e320 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesCapacitySched.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesCapacitySched.java
@@ -40,6 +40,7 @@ import org.apache.hadoop.yarn.webapp.WebServicesTestUtils;
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.w3c.dom.Document;
@@ -374,6 +375,8 @@ public class TestRMWebServicesCapacitySched extends JerseyTest {
verifySubQueue(obj, q2, qi.absoluteCapacity, qi.absoluteMaxCapacity);
}
} else {
+ Assert.assertEquals("\"type\" field is incorrect",
+ "capacitySchedulerLeafQueueInfo", info.getString("type"));
LeafQueueInfo lqi = (LeafQueueInfo) qi;
lqi.numActiveApplications = info.getInt("numActiveApplications");
lqi.numPendingApplications = info.getInt("numPendingApplications");