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 org.apache.hadoop.classification.InterfaceAudience.Private; 022 import org.apache.hadoop.classification.InterfaceAudience.Public; 023 import org.apache.hadoop.classification.InterfaceStability.Stable; 024 import org.apache.hadoop.classification.InterfaceStability.Unstable; 025 import org.apache.hadoop.yarn.util.Records; 026 027 /** 028 * Contains various scheduling metrics to be reported by UI and CLI. 029 */ 030 @Public 031 @Stable 032 public abstract class ApplicationResourceUsageReport { 033 034 @Private 035 @Unstable 036 public static ApplicationResourceUsageReport newInstance( 037 int numUsedContainers, int numReservedContainers, Resource usedResources, 038 Resource reservedResources, Resource neededResources) { 039 ApplicationResourceUsageReport report = 040 Records.newRecord(ApplicationResourceUsageReport.class); 041 report.setNumUsedContainers(numUsedContainers); 042 report.setNumReservedContainers(numReservedContainers); 043 report.setUsedResources(usedResources); 044 report.setReservedResources(reservedResources); 045 report.setNeededResources(neededResources); 046 return report; 047 } 048 049 /** 050 * Get the number of used containers 051 * @return the number of used containers 052 */ 053 @Public 054 @Stable 055 public abstract int getNumUsedContainers(); 056 057 /** 058 * Set the number of used containers 059 * @param num_containers the number of used containers 060 */ 061 @Private 062 @Unstable 063 public abstract void setNumUsedContainers(int num_containers); 064 065 /** 066 * Get the number of reserved containers 067 * @return the number of reserved containers 068 */ 069 @Private 070 @Unstable 071 public abstract int getNumReservedContainers(); 072 073 /** 074 * Set the number of reserved containers 075 * @param num_reserved_containers the number of reserved containers 076 */ 077 @Private 078 @Unstable 079 public abstract void setNumReservedContainers(int num_reserved_containers); 080 081 /** 082 * Get the used <code>Resource</code> 083 * @return the used <code>Resource</code> 084 */ 085 @Public 086 @Stable 087 public abstract Resource getUsedResources(); 088 089 @Private 090 @Unstable 091 public abstract void setUsedResources(Resource resources); 092 093 /** 094 * Get the reserved <code>Resource</code> 095 * @return the reserved <code>Resource</code> 096 */ 097 @Public 098 @Stable 099 public abstract Resource getReservedResources(); 100 101 @Private 102 @Unstable 103 public abstract void setReservedResources(Resource reserved_resources); 104 105 /** 106 * Get the needed <code>Resource</code> 107 * @return the needed <code>Resource</code> 108 */ 109 @Public 110 @Stable 111 public abstract Resource getNeededResources(); 112 113 @Private 114 @Unstable 115 public abstract void setNeededResources(Resource needed_resources); 116 }