This is an automated email from the ASF dual-hosted git repository.

madhan pushed a commit to branch ranger-2.8
in repository https://gitbox.apache.org/repos/asf/ranger.git


The following commit(s) were added to refs/heads/ranger-2.8 by this push:
     new bb30658b1 RANGER-3222: update YARN plugin to support fair scheduler 
(#92)
bb30658b1 is described below

commit bb30658b1c5d6b21719acc061bede391a229a23c
Author: FoolishWall <[email protected]>
AuthorDate: Sun Jan 4 10:04:11 2026 +0800

    RANGER-3222: update YARN plugin to support fair scheduler (#92)
    
    Co-authored-by: Wall <[email protected]>
    Co-authored-by: Madhan Neethiraj <[email protected]>
    (cherry picked from commit c034ef3837e6f6377edd1fc540778c768e1a33ec)
---
 .../client/json/model/YarnSchedulerResponse.java   | 99 +++++++++++++++++++---
 1 file changed, 86 insertions(+), 13 deletions(-)

diff --git 
a/plugin-yarn/src/main/java/org/apache/ranger/services/yarn/client/json/model/YarnSchedulerResponse.java
 
b/plugin-yarn/src/main/java/org/apache/ranger/services/yarn/client/json/model/YarnSchedulerResponse.java
index fdd4f063e..b5e857066 100644
--- 
a/plugin-yarn/src/main/java/org/apache/ranger/services/yarn/client/json/model/YarnSchedulerResponse.java
+++ 
b/plugin-yarn/src/main/java/org/apache/ranger/services/yarn/client/json/model/YarnSchedulerResponse.java
@@ -34,7 +34,11 @@
 public class YarnSchedulerResponse implements java.io.Serializable {
     private static final long serialVersionUID = 1L;
 
-    private YarnScheduler scheduler = null;
+    private static final String FAIR_SCHEDULER                = 
"fairScheduler";
+    private static final String CAPACITY_SCHEDULER            = 
"capacityScheduler";
+    private static final String CAPACITY_SCHEDULER_LEAF_QUEUE = 
"capacitySchedulerLeafQueueInfo";
+
+    private YarnScheduler scheduler;
 
     public YarnScheduler getScheduler() { return scheduler; }
 
@@ -72,23 +76,43 @@ public void collectQueueNames(List<String> queueNames) {
     public static class YarnSchedulerInfo implements java.io.Serializable {
         private static final long serialVersionUID = 1L;
 
-        private String     queueName = null;
-        private YarnQueues queues    = null;
+        private String     type; // support fair schedule
+        private RootQueue  rootQueue;
+        private String     queueName;
+        private YarnQueues queues;
 
-        public String getQueueName() { return queueName; }
+        public String getType() {
+            return type;
+        }
 
-        public YarnQueues getQueues() { return queues; }
+        public  RootQueue getRootQueue() {
+            return rootQueue;
+        }
 
-        public void collectQueueNames(List<String> queueNames, String 
parentQueueName) {
-               if(queueName != null) {
-                       String queueFqdn = parentQueueName == null ? queueName 
: parentQueueName + "." + queueName;
+        public String getQueueName() {
+            return queueName;
+        }
 
-                       queueNames.add(queueFqdn);
+        public YarnQueues getQueues() { return queues; }
 
-               if(queues != null) {
-                       queues.collectQueueNames(queueNames, queueFqdn);
-               }
-               }
+        public void collectQueueNames(List<String> queueNames, String 
parentQueueName) {
+            if (type != null) {
+                if (type.equals(FAIR_SCHEDULER)) {
+                    if (rootQueue != null) {
+                        rootQueue.collectQueueNames(queueNames);
+                    }
+                } else if (type.equals(CAPACITY_SCHEDULER) || 
type.equals(CAPACITY_SCHEDULER_LEAF_QUEUE)) {
+                    if (queueName != null) {
+                        String queueFqdn = parentQueueName == null ? queueName 
: parentQueueName + "." + queueName;
+
+                        queueNames.add(queueFqdn);
+
+                        if (queues != null) {
+                            queues.collectQueueNames(queueNames, queueFqdn);
+                        }
+                    }
+                }
+            }
         }
     }
 
@@ -110,4 +134,53 @@ public void collectQueueNames(List<String> queueNames, 
String parentQueueName) {
                }
         }
     }
+
+    @JsonAutoDetect(getterVisibility = JsonAutoDetect.Visibility.NONE, 
setterVisibility = JsonAutoDetect.Visibility.NONE, fieldVisibility = 
JsonAutoDetect.Visibility.ANY)
+    @JsonInclude(JsonInclude.Include.NON_NULL)
+    @JsonIgnoreProperties(ignoreUnknown = true)
+    public static class RootQueue implements java.io.Serializable {
+        private static final long serialVersionUID = 1L;
+
+        private String      queueName;
+        private ChildQueues childQueues;
+
+        public String getQueueName() {
+            return queueName;
+        }
+
+        public ChildQueues getChildQueues() {
+            return childQueues;
+        }
+
+        public void collectQueueNames(List<String> queueNames) {
+            if (queueName != null) {
+                queueNames.add(queueName);
+
+                if (childQueues != null) {
+                    childQueues.collectQueueNames(queueNames);
+                }
+            }
+        }
+    }
+
+    @JsonAutoDetect(getterVisibility = JsonAutoDetect.Visibility.NONE, 
setterVisibility = JsonAutoDetect.Visibility.NONE, fieldVisibility = 
JsonAutoDetect.Visibility.ANY)
+    @JsonInclude(JsonInclude.Include.NON_NULL)
+    @JsonIgnoreProperties(ignoreUnknown = true)
+    public static class ChildQueues implements java.io.Serializable {
+        private static final long serialVersionUID = 1L;
+
+        private List<RootQueue> queue;
+
+        public List<RootQueue> getQueue() {
+            return queue;
+        }
+
+        public void collectQueueNames(List<String> queueNames) {
+            if (queue != null) {
+                for (RootQueue queue : queue) {
+                    queue.collectQueueNames(queueNames);
+                }
+            }
+        }
+    }
 }

Reply via email to