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 org.apache.hadoop.classification.InterfaceAudience; 022import org.apache.hadoop.classification.InterfaceStability; 023import org.apache.hadoop.yarn.util.Records; 024 025@InterfaceAudience.Public 026@InterfaceStability.Unstable 027public abstract class QueueStatistics { 028 029 @InterfaceAudience.Private 030 @InterfaceStability.Unstable 031 public static QueueStatistics newInstance(long submitted, long running, 032 long pending, long completed, long killed, long failed, long activeUsers, 033 long availableMemoryMB, long allocatedMemoryMB, long pendingMemoryMB, 034 long reservedMemoryMB, long availableVCores, long allocatedVCores, 035 long pendingVCores, long reservedVCores) { 036 QueueStatistics statistics = Records.newRecord(QueueStatistics.class); 037 statistics.setNumAppsSubmitted(submitted); 038 statistics.setNumAppsRunning(running); 039 statistics.setNumAppsPending(pending); 040 statistics.setNumAppsCompleted(completed); 041 statistics.setNumAppsKilled(killed); 042 statistics.setNumAppsFailed(failed); 043 statistics.setNumActiveUsers(activeUsers); 044 statistics.setAvailableMemoryMB(availableMemoryMB); 045 statistics.setAllocatedMemoryMB(allocatedMemoryMB); 046 statistics.setPendingMemoryMB(pendingMemoryMB); 047 statistics.setReservedMemoryMB(reservedMemoryMB); 048 statistics.setAvailableVCores(availableVCores); 049 statistics.setAllocatedVCores(allocatedVCores); 050 statistics.setPendingVCores(pendingVCores); 051 statistics.setReservedVCores(reservedVCores); 052 return statistics; 053 } 054 055 /** 056 * Get the number of apps submitted 057 * 058 * @return the number of apps submitted 059 */ 060 public abstract long getNumAppsSubmitted(); 061 062 /** 063 * Set the number of apps submitted 064 * 065 * @param numAppsSubmitted 066 * the number of apps submitted 067 */ 068 public abstract void setNumAppsSubmitted(long numAppsSubmitted); 069 070 /** 071 * Get the number of running apps 072 * 073 * @return the number of running apps 074 */ 075 public abstract long getNumAppsRunning(); 076 077 /** 078 * Set the number of running apps 079 * 080 * @param numAppsRunning 081 * the number of running apps 082 */ 083 public abstract void setNumAppsRunning(long numAppsRunning); 084 085 /** 086 * Get the number of pending apps 087 * 088 * @return the number of pending apps 089 */ 090 public abstract long getNumAppsPending(); 091 092 /** 093 * Set the number of pending apps 094 * 095 * @param numAppsPending 096 * the number of pending apps 097 */ 098 public abstract void setNumAppsPending(long numAppsPending); 099 100 /** 101 * Get the number of completed apps 102 * 103 * @return the number of completed apps 104 */ 105 public abstract long getNumAppsCompleted(); 106 107 /** 108 * Set the number of completed apps 109 * 110 * @param numAppsCompleted 111 * the number of completed apps 112 */ 113 public abstract void setNumAppsCompleted(long numAppsCompleted); 114 115 /** 116 * Get the number of killed apps 117 * 118 * @return the number of killed apps 119 */ 120 public abstract long getNumAppsKilled(); 121 122 /** 123 * Set the number of killed apps 124 * 125 * @param numAppsKilled 126 * the number of killed apps 127 */ 128 public abstract void setNumAppsKilled(long numAppsKilled); 129 130 /** 131 * Get the number of failed apps 132 * 133 * @return the number of failed apps 134 */ 135 public abstract long getNumAppsFailed(); 136 137 /** 138 * Set the number of failed apps 139 * 140 * @param numAppsFailed 141 * the number of failed apps 142 */ 143 public abstract void setNumAppsFailed(long numAppsFailed); 144 145 /** 146 * Get the number of active users 147 * 148 * @return the number of active users 149 */ 150 public abstract long getNumActiveUsers(); 151 152 /** 153 * Set the number of active users 154 * 155 * @param numActiveUsers 156 * the number of active users 157 */ 158 public abstract void setNumActiveUsers(long numActiveUsers); 159 160 /** 161 * Get the available memory in MB 162 * 163 * @return the available memory 164 */ 165 public abstract long getAvailableMemoryMB(); 166 167 /** 168 * Set the available memory in MB 169 * 170 * @param availableMemoryMB 171 * the available memory 172 */ 173 public abstract void setAvailableMemoryMB(long availableMemoryMB); 174 175 /** 176 * Get the allocated memory in MB 177 * 178 * @return the allocated memory 179 */ 180 public abstract long getAllocatedMemoryMB(); 181 182 /** 183 * Set the allocated memory in MB 184 * 185 * @param allocatedMemoryMB 186 * the allocate memory 187 */ 188 public abstract void setAllocatedMemoryMB(long allocatedMemoryMB); 189 190 /** 191 * Get the pending memory in MB 192 * 193 * @return the pending memory 194 */ 195 public abstract long getPendingMemoryMB(); 196 197 /** 198 * Set the pending memory in MB 199 * 200 * @param pendingMemoryMB 201 * the pending memory 202 */ 203 public abstract void setPendingMemoryMB(long pendingMemoryMB); 204 205 /** 206 * Get the reserved memory in MB 207 * 208 * @return the reserved memory 209 */ 210 public abstract long getReservedMemoryMB(); 211 212 /** 213 * Set the reserved memory in MB 214 * 215 * @param reservedMemoryMB 216 * the reserved memory 217 */ 218 public abstract void setReservedMemoryMB(long reservedMemoryMB); 219 220 /** 221 * Get the available vcores 222 * 223 * @return the available vcores 224 */ 225 public abstract long getAvailableVCores(); 226 227 /** 228 * Set the available vcores 229 * 230 * @param availableVCores 231 * the available vcores 232 */ 233 public abstract void setAvailableVCores(long availableVCores); 234 235 /** 236 * Get the allocated vcores 237 * 238 * @return the allocated vcores 239 */ 240 public abstract long getAllocatedVCores(); 241 242 /** 243 * Set the allocated vcores 244 * 245 * @param allocatedVCores 246 * the allocated vcores 247 */ 248 public abstract void setAllocatedVCores(long allocatedVCores); 249 250 /** 251 * Get the pending vcores 252 * 253 * @return the pending vcores 254 */ 255 public abstract long getPendingVCores(); 256 257 /** 258 * Set the pending vcores 259 * 260 * @param pendingVCores 261 * the pending vcores 262 */ 263 public abstract void setPendingVCores(long pendingVCores); 264 265 /** 266 * Get the number of pending containers. 267 * @return the number of pending containers. 268 */ 269 public abstract long getPendingContainers(); 270 271 /** 272 * Set the number of pending containers. 273 * @param pendingContainers the pending containers. 274 */ 275 public abstract void setPendingContainers(long pendingContainers); 276 277 /** 278 * Get the number of allocated containers. 279 * @return the number of allocated containers. 280 */ 281 public abstract long getAllocatedContainers(); 282 283 /** 284 * Set the number of allocated containers. 285 * @param allocatedContainers the allocated containers. 286 */ 287 public abstract void setAllocatedContainers(long allocatedContainers); 288 289 /** 290 * Get the number of reserved containers. 291 * @return the number of reserved containers. 292 */ 293 public abstract long getReservedContainers(); 294 295 /** 296 * Set the number of reserved containers. 297 * @param reservedContainers the reserved containers. 298 */ 299 public abstract void setReservedContainers(long reservedContainers); 300 301 /** 302 * Get the reserved vcores 303 * 304 * @return the reserved vcores 305 */ 306 public abstract long getReservedVCores(); 307 308 /** 309 * Set the reserved vcores 310 * 311 * @param reservedVCores 312 * the reserved vcores 313 */ 314 public abstract void setReservedVCores(long reservedVCores); 315}