YARN-4785. inconsistent value type of the type field for LeafQueueInfo in response of RM REST API. Contributed by Varun Vasudev.
This commit is contained in:
parent
d593976ffc
commit
bb5749b1e0
@ -107,6 +107,9 @@ Release 2.7.3 - UNRELEASED
|
|||||||
YARN-4760. proxy redirect to history server uses wrong URL (Eric Badger
|
YARN-4760. proxy redirect to history server uses wrong URL (Eric Badger
|
||||||
via jlowe)
|
via jlowe)
|
||||||
|
|
||||||
|
YARN-4785. inconsistent value type of the "type" field for LeafQueueInfo
|
||||||
|
in response of RM REST API. (Varun Vasudev via junping_du)
|
||||||
|
|
||||||
Release 2.7.2 - 2016-01-25
|
Release 2.7.2 - 2016-01-25
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -27,6 +27,9 @@
|
|||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CSQueue;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CSQueue;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.LeafQueue;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.LeafQueue;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@XmlRootElement(name = "capacityScheduler")
|
@XmlRootElement(name = "capacityScheduler")
|
||||||
@XmlType(name = "capacityScheduler")
|
@XmlType(name = "capacityScheduler")
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
@ -77,9 +80,27 @@ public CapacitySchedulerQueueInfoList getQueues() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected CapacitySchedulerQueueInfoList getQueues(CSQueue parent) {
|
protected CapacitySchedulerQueueInfoList getQueues(CSQueue parent) {
|
||||||
CSQueue parentQueue = parent;
|
CapacitySchedulerQueueInfoList queuesInfo =
|
||||||
CapacitySchedulerQueueInfoList queuesInfo = new CapacitySchedulerQueueInfoList();
|
new CapacitySchedulerQueueInfoList();
|
||||||
for (CSQueue queue : parentQueue.getChildQueues()) {
|
|
||||||
|
// 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<>();
|
||||||
|
List<CSQueue> childLeafQueues = new ArrayList<>();
|
||||||
|
List<CSQueue> childNonLeafQueues = new ArrayList<>();
|
||||||
|
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;
|
CapacitySchedulerQueueInfo info;
|
||||||
if (queue instanceof LeafQueue) {
|
if (queue instanceof LeafQueue) {
|
||||||
info = new CapacitySchedulerLeafQueueInfo((LeafQueue) queue);
|
info = new CapacitySchedulerLeafQueueInfo((LeafQueue) queue);
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
import org.codehaus.jettison.json.JSONArray;
|
import org.codehaus.jettison.json.JSONArray;
|
||||||
import org.codehaus.jettison.json.JSONException;
|
import org.codehaus.jettison.json.JSONException;
|
||||||
import org.codehaus.jettison.json.JSONObject;
|
import org.codehaus.jettison.json.JSONObject;
|
||||||
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
@ -374,6 +375,8 @@ private void verifySubQueue(JSONObject info, String q,
|
|||||||
verifySubQueue(obj, q2, qi.absoluteCapacity, qi.absoluteMaxCapacity);
|
verifySubQueue(obj, q2, qi.absoluteCapacity, qi.absoluteMaxCapacity);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Assert.assertEquals("\"type\" field is incorrect",
|
||||||
|
"capacitySchedulerLeafQueueInfo", info.getString("type"));
|
||||||
LeafQueueInfo lqi = (LeafQueueInfo) qi;
|
LeafQueueInfo lqi = (LeafQueueInfo) qi;
|
||||||
lqi.numActiveApplications = info.getInt("numActiveApplications");
|
lqi.numActiveApplications = info.getInt("numActiveApplications");
|
||||||
lqi.numPendingApplications = info.getInt("numPendingApplications");
|
lqi.numPendingApplications = info.getInt("numPendingApplications");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user