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 019package org.apache.hadoop.yarn.api.records; 020 021import java.util.List; 022import java.util.Set; 023 024import org.apache.hadoop.classification.InterfaceAudience.Private; 025import org.apache.hadoop.classification.InterfaceAudience.Public; 026import org.apache.hadoop.classification.InterfaceStability.Stable; 027import org.apache.hadoop.classification.InterfaceStability.Unstable; 028import org.apache.hadoop.yarn.api.ApplicationClientProtocol; 029import org.apache.hadoop.yarn.util.Records; 030 031/** 032 * <p>QueueInfo is a report of the runtime information of the queue.</p> 033 * 034 * <p>It includes information such as: 035 * <ul> 036 * <li>Queue name.</li> 037 * <li>Capacity of the queue.</li> 038 * <li>Maximum capacity of the queue.</li> 039 * <li>Current capacity of the queue.</li> 040 * <li>Child queues.</li> 041 * <li>Running applications.</li> 042 * <li>{@link QueueState} of the queue.</li> 043 * </ul> 044 * </p> 045 * 046 * @see QueueState 047 * @see ApplicationClientProtocol#getQueueInfo(org.apache.hadoop.yarn.api.protocolrecords.GetQueueInfoRequest) 048 */ 049@Public 050@Stable 051public abstract class QueueInfo { 052 053 @Private 054 @Unstable 055 public static QueueInfo newInstance(String queueName, float capacity, 056 float maximumCapacity, float currentCapacity, 057 List<QueueInfo> childQueues, List<ApplicationReport> applications, 058 QueueState queueState, Set<String> accessibleNodeLabels, 059 String defaultNodeLabelExpression, QueueStatistics queueStatistics) { 060 QueueInfo queueInfo = Records.newRecord(QueueInfo.class); 061 queueInfo.setQueueName(queueName); 062 queueInfo.setCapacity(capacity); 063 queueInfo.setMaximumCapacity(maximumCapacity); 064 queueInfo.setCurrentCapacity(currentCapacity); 065 queueInfo.setChildQueues(childQueues); 066 queueInfo.setApplications(applications); 067 queueInfo.setQueueState(queueState); 068 queueInfo.setAccessibleNodeLabels(accessibleNodeLabels); 069 queueInfo.setDefaultNodeLabelExpression(defaultNodeLabelExpression); 070 queueInfo.setQueueStatistics(queueStatistics); 071 return queueInfo; 072 } 073 074 /** 075 * Get the <em>name</em> of the queue. 076 * @return <em>name</em> of the queue 077 */ 078 @Public 079 @Stable 080 public abstract String getQueueName(); 081 082 @Private 083 @Unstable 084 public abstract void setQueueName(String queueName); 085 086 /** 087 * Get the <em>configured capacity</em> of the queue. 088 * @return <em>configured capacity</em> of the queue 089 */ 090 @Public 091 @Stable 092 public abstract float getCapacity(); 093 094 @Private 095 @Unstable 096 public abstract void setCapacity(float capacity); 097 098 /** 099 * Get the <em>maximum capacity</em> of the queue. 100 * @return <em>maximum capacity</em> of the queue 101 */ 102 @Public 103 @Stable 104 public abstract float getMaximumCapacity(); 105 106 @Private 107 @Unstable 108 public abstract void setMaximumCapacity(float maximumCapacity); 109 110 /** 111 * Get the <em>current capacity</em> of the queue. 112 * @return <em>current capacity</em> of the queue 113 */ 114 @Public 115 @Stable 116 public abstract float getCurrentCapacity(); 117 118 @Private 119 @Unstable 120 public abstract void setCurrentCapacity(float currentCapacity); 121 122 /** 123 * Get the <em>child queues</em> of the queue. 124 * @return <em>child queues</em> of the queue 125 */ 126 @Public 127 @Stable 128 public abstract List<QueueInfo> getChildQueues(); 129 130 @Private 131 @Unstable 132 public abstract void setChildQueues(List<QueueInfo> childQueues); 133 134 /** 135 * Get the <em>running applications</em> of the queue. 136 * @return <em>running applications</em> of the queue 137 */ 138 @Public 139 @Stable 140 public abstract List<ApplicationReport> getApplications(); 141 142 @Private 143 @Unstable 144 public abstract void setApplications(List<ApplicationReport> applications); 145 146 /** 147 * Get the <code>QueueState</code> of the queue. 148 * @return <code>QueueState</code> of the queue 149 */ 150 @Public 151 @Stable 152 public abstract QueueState getQueueState(); 153 154 @Private 155 @Unstable 156 public abstract void setQueueState(QueueState queueState); 157 158 /** 159 * Get the <code>accessible node labels</code> of the queue. 160 * @return <code>accessible node labels</code> of the queue 161 */ 162 @Public 163 @Stable 164 public abstract Set<String> getAccessibleNodeLabels(); 165 166 /** 167 * Set the <code>accessible node labels</code> of the queue. 168 */ 169 @Private 170 @Unstable 171 public abstract void setAccessibleNodeLabels(Set<String> labels); 172 173 /** 174 * Get the <code>default node label expression</code> of the queue, this takes 175 * affect only when the <code>ApplicationSubmissionContext</code> and 176 * <code>ResourceRequest</code> don't specify their 177 * <code>NodeLabelExpression</code>. 178 * 179 * @return <code>default node label expression</code> of the queue 180 */ 181 @Public 182 @Stable 183 public abstract String getDefaultNodeLabelExpression(); 184 185 @Public 186 @Stable 187 public abstract void setDefaultNodeLabelExpression( 188 String defaultLabelExpression); 189 190 /** 191 * Get the <code>queue stats</code> for the queue 192 * 193 * @return <code>queue stats</code> of the queue 194 */ 195 @Public 196 @Unstable 197 public abstract QueueStatistics getQueueStatistics(); 198 199 /** 200 * Set the queue statistics for the queue 201 * 202 * @param queueStatistics 203 * the queue statistics 204 */ 205 @Public 206 @Unstable 207 public abstract void setQueueStatistics(QueueStatistics queueStatistics); 208 209}