|
@@ -19,6 +19,7 @@ package org.apache.hadoop.yarn.server.resourcemanager.webapp.dao;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collections;
|
|
|
+import java.util.Map;
|
|
|
import java.util.Set;
|
|
|
|
|
|
import javax.xml.bind.annotation.XmlAccessType;
|
|
@@ -27,10 +28,16 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|
|
import javax.xml.bind.annotation.XmlSeeAlso;
|
|
|
import javax.xml.bind.annotation.XmlTransient;
|
|
|
|
|
|
+import org.apache.hadoop.util.StringUtils;
|
|
|
+import org.apache.hadoop.security.authorize.AccessControlList;
|
|
|
import org.apache.hadoop.yarn.api.records.QueueState;
|
|
|
+import org.apache.hadoop.yarn.security.AccessType;
|
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.QueueResourceQuotas;
|
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceUsage;
|
|
|
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler;
|
|
|
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration;
|
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CSQueue;
|
|
|
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.ParentQueue;
|
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.PlanQueue;
|
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.QueueCapacities;
|
|
|
|
|
@@ -65,11 +72,15 @@ public class CapacitySchedulerQueueInfo {
|
|
|
protected ResourcesInfo resources;
|
|
|
protected ResourceInfo minEffectiveCapacity;
|
|
|
protected ResourceInfo maxEffectiveCapacity;
|
|
|
+ protected ResourceInfo maximumAllocation;
|
|
|
+ protected QueueAclsInfo queueAcls;
|
|
|
+ protected int queuePriority;
|
|
|
+ protected String orderingPolicyInfo;
|
|
|
|
|
|
CapacitySchedulerQueueInfo() {
|
|
|
};
|
|
|
|
|
|
- CapacitySchedulerQueueInfo(CSQueue q) {
|
|
|
+ CapacitySchedulerQueueInfo(CapacityScheduler cs, CSQueue q) {
|
|
|
|
|
|
queuePath = q.getQueuePath();
|
|
|
capacity = q.getCapacity() * 100;
|
|
@@ -114,6 +125,31 @@ public class CapacitySchedulerQueueInfo {
|
|
|
q.getQueueResourceQuotas().getEffectiveMinResource());
|
|
|
maxEffectiveCapacity = new ResourceInfo(
|
|
|
q.getQueueResourceQuotas().getEffectiveMaxResource());
|
|
|
+ maximumAllocation = new ResourceInfo(q.getMaximumAllocation());
|
|
|
+
|
|
|
+ CapacitySchedulerConfiguration conf = cs.getConfiguration();
|
|
|
+ queueAcls = new QueueAclsInfo();
|
|
|
+ for (Map.Entry<AccessType, AccessControlList> e : conf
|
|
|
+ .getAcls(queuePath).entrySet()) {
|
|
|
+ QueueAclInfo queueAcl = new QueueAclInfo(e.getKey().toString(),
|
|
|
+ e.getValue().getAclString());
|
|
|
+ queueAcls.add(queueAcl);
|
|
|
+ }
|
|
|
+
|
|
|
+ String aclApplicationMaxPriority = "acl_" +
|
|
|
+ StringUtils.toLowerCase(AccessType.APPLICATION_MAX_PRIORITY.toString());
|
|
|
+ String priorityAcls = conf.get(CapacitySchedulerConfiguration
|
|
|
+ .getQueuePrefix(queuePath) + aclApplicationMaxPriority, conf.ALL_ACL);
|
|
|
+
|
|
|
+ QueueAclInfo queueAcl = new QueueAclInfo(
|
|
|
+ AccessType.APPLICATION_MAX_PRIORITY.toString(), priorityAcls);
|
|
|
+ queueAcls.add(queueAcl);
|
|
|
+
|
|
|
+ queuePriority = q.getPriority().getPriority();
|
|
|
+ if (q instanceof ParentQueue) {
|
|
|
+ orderingPolicyInfo = ((ParentQueue) q).getQueueOrderingPolicy()
|
|
|
+ .getConfigName();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
protected void populateQueueResourceUsage(ResourceUsage queueResourceUsage) {
|
|
@@ -220,6 +256,22 @@ public class CapacitySchedulerQueueInfo {
|
|
|
return maxEffectiveCapacity;
|
|
|
}
|
|
|
|
|
|
+ public ResourceInfo getMaximumAllocation() {
|
|
|
+ return maximumAllocation;
|
|
|
+ }
|
|
|
+
|
|
|
+ public QueueAclsInfo getQueueAcls() {
|
|
|
+ return queueAcls;
|
|
|
+ }
|
|
|
+
|
|
|
+ public int getPriority() {
|
|
|
+ return queuePriority;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getOrderingPolicyInfo() {
|
|
|
+ return orderingPolicyInfo;
|
|
|
+ }
|
|
|
+
|
|
|
public boolean isLeafQueue() {
|
|
|
return getQueues() == null;
|
|
|
}
|