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

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


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

commit c034ef3837e6f6377edd1fc540778c768e1a33ec
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]>
---
 .../client/json/model/YarnSchedulerResponse.java   | 89 +++++++++++++++++++---
 1 file changed, 80 insertions(+), 9 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 548a0eb76..ee74e6922 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
@@ -31,7 +31,11 @@
 public class YarnSchedulerResponse implements java.io.Serializable {
     private static final long serialVersionUID = 1L;
 
-    private final 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,10 +76,20 @@ public void collectQueueNames(List<String> queueNames) {
     public static class YarnSchedulerInfo implements java.io.Serializable {
         private static final long serialVersionUID = 1L;
 
+        private String     type; // support fair schedule
+        private RootQueue  rootQueue;
         private String     queueName;
         private YarnQueues queues;
 
-        public String getQueueName()  {
+        public String getType() {
+            return type;
+        }
+
+        public  RootQueue getRootQueue() {
+            return rootQueue;
+        }
+
+        public String getQueueName() {
             return queueName;
         }
 
@@ -84,13 +98,21 @@ public YarnQueues getQueues() {
         }
 
         public void collectQueueNames(List<String> queueNames, String 
parentQueueName) {
-            if (queueName != null) {
-                String queueFqdn = parentQueueName == null ? queueName : 
parentQueueName + "." + queueName;
-
-                queueNames.add(queueFqdn);
-
-                if (queues != null) {
-                    queues.collectQueueNames(queueNames, queueFqdn);
+            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);
+                        }
+                    }
                 }
             }
         }
@@ -116,4 +138,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