001    /**
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements.  See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership.  The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the
007     * "License"); you may not use this file except in compliance
008     * with the License.  You may obtain a copy of the License at
009     *
010     *     http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing, software
013     * distributed under the License is distributed on an "AS IS" BASIS,
014     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015     * See the License for the specific language governing permissions and
016     * limitations under the License.
017     */
018    
019    package org.apache.hadoop.yarn.api.records;
020    
021    import java.util.List;
022    
023    import org.apache.hadoop.classification.InterfaceAudience.Private;
024    import org.apache.hadoop.classification.InterfaceAudience.Public;
025    import org.apache.hadoop.classification.InterfaceStability.Stable;
026    import org.apache.hadoop.classification.InterfaceStability.Unstable;
027    import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
028    import org.apache.hadoop.yarn.util.Records;
029    
030    /**
031     * <p>QueueInfo is a report of the runtime information of the queue.</p>
032     * 
033     * <p>It includes information such as:
034     *   <ul>
035     *     <li>Queue name.</li>
036     *     <li>Capacity of the queue.</li>
037     *     <li>Maximum capacity of the queue.</li>
038     *     <li>Current capacity of the queue.</li>
039     *     <li>Child queues.</li>
040     *     <li>Running applications.</li>
041     *     <li>{@link QueueState} of the queue.</li>
042     *   </ul>
043     * </p>
044     *
045     * @see QueueState
046     * @see ApplicationClientProtocol#getQueueInfo(org.apache.hadoop.yarn.api.protocolrecords.GetQueueInfoRequest)
047     */
048    @Public
049    @Stable
050    public abstract class QueueInfo {
051    
052      @Private
053      @Unstable
054      public static QueueInfo newInstance(String queueName, float capacity,
055          float maximumCapacity, float currentCapacity,
056          List<QueueInfo> childQueues, List<ApplicationReport> applications,
057          QueueState queueState) {
058        QueueInfo queueInfo = Records.newRecord(QueueInfo.class);
059        queueInfo.setQueueName(queueName);
060        queueInfo.setCapacity(capacity);
061        queueInfo.setMaximumCapacity(maximumCapacity);
062        queueInfo.setCurrentCapacity(currentCapacity);
063        queueInfo.setChildQueues(childQueues);
064        queueInfo.setApplications(applications);
065        queueInfo.setQueueState(queueState);
066        return queueInfo;
067      }
068    
069      /**
070       * Get the <em>name</em> of the queue.
071       * @return <em>name</em> of the queue
072       */
073      @Public
074      @Stable
075      public abstract String getQueueName();
076      
077      @Private
078      @Unstable
079      public abstract void setQueueName(String queueName);
080      
081      /**
082       * Get the <em>configured capacity</em> of the queue.
083       * @return <em>configured capacity</em> of the queue
084       */
085      @Public
086      @Stable
087      public abstract float getCapacity();
088      
089      @Private
090      @Unstable
091      public abstract void setCapacity(float capacity);
092      
093      /**
094       * Get the <em>maximum capacity</em> of the queue.
095       * @return <em>maximum capacity</em> of the queue
096       */
097      @Public
098      @Stable
099      public abstract float getMaximumCapacity();
100      
101      @Private
102      @Unstable
103      public abstract void setMaximumCapacity(float maximumCapacity);
104      
105      /**
106       * Get the <em>current capacity</em> of the queue.
107       * @return <em>current capacity</em> of the queue
108       */
109      @Public
110      @Stable
111      public abstract float getCurrentCapacity();
112      
113      @Private
114      @Unstable
115      public abstract void setCurrentCapacity(float currentCapacity);
116      
117      /**
118       * Get the <em>child queues</em> of the queue.
119       * @return <em>child queues</em> of the queue
120       */
121      @Public
122      @Stable
123      public abstract List<QueueInfo> getChildQueues();
124      
125      @Private
126      @Unstable
127      public abstract void setChildQueues(List<QueueInfo> childQueues);
128      
129      /**
130       * Get the <em>running applications</em> of the queue.
131       * @return <em>running applications</em> of the queue
132       */
133      @Public
134      @Stable
135      public abstract List<ApplicationReport> getApplications();
136      
137      @Private
138      @Unstable
139      public abstract void setApplications(List<ApplicationReport> applications);
140      
141      /**
142       * Get the <code>QueueState</code> of the queue.
143       * @return <code>QueueState</code> of the queue
144       */
145      @Public
146      @Stable
147      public abstract QueueState getQueueState();
148      
149      @Private
150      @Unstable
151      public abstract void setQueueState(QueueState queueState);
152    }