Browse Source

YARN-7137. [YARN-3926] Move newly added APIs to unstable in YARN-3926 branch. Contributed by Wangda Tan.

Sunil G 7 years ago
parent
commit
da0b6a354b

+ 12 - 12
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java

@@ -206,8 +206,8 @@ public abstract class Resource implements Comparable<Resource> {
    *
    *
    * @return Map of resource name to ResourceInformation
    * @return Map of resource name to ResourceInformation
    */
    */
-  @Public
-  @Evolving
+  @InterfaceAudience.Private
+  @InterfaceStability.Unstable
   public ResourceInformation[] getResources() {
   public ResourceInformation[] getResources() {
     return resources;
     return resources;
   }
   }
@@ -220,7 +220,7 @@ public abstract class Resource implements Comparable<Resource> {
    * @throws ResourceNotFoundException if the resource can't be found
    * @throws ResourceNotFoundException if the resource can't be found
    */
    */
   @Public
   @Public
-  @Evolving
+  @InterfaceStability.Unstable
   public ResourceInformation getResourceInformation(String resource)
   public ResourceInformation getResourceInformation(String resource)
       throws ResourceNotFoundException {
       throws ResourceNotFoundException {
     Integer index = ResourceUtils.getResourceTypeIndex().get(resource);
     Integer index = ResourceUtils.getResourceTypeIndex().get(resource);
@@ -240,8 +240,8 @@ public abstract class Resource implements Comparable<Resource> {
    * @throws ResourceNotFoundException
    * @throws ResourceNotFoundException
    *           if the resource can't be found
    *           if the resource can't be found
    */
    */
-  @Public
-  @Evolving
+  @InterfaceAudience.Private
+  @InterfaceStability.Unstable
   public ResourceInformation getResourceInformation(int index)
   public ResourceInformation getResourceInformation(int index)
       throws ResourceNotFoundException {
       throws ResourceNotFoundException {
     ResourceInformation ri = null;
     ResourceInformation ri = null;
@@ -262,7 +262,7 @@ public abstract class Resource implements Comparable<Resource> {
    * @throws ResourceNotFoundException if the resource can't be found
    * @throws ResourceNotFoundException if the resource can't be found
    */
    */
   @Public
   @Public
-  @Evolving
+  @InterfaceStability.Unstable
   public long getResourceValue(String resource)
   public long getResourceValue(String resource)
       throws ResourceNotFoundException {
       throws ResourceNotFoundException {
     return getResourceInformation(resource).getValue();
     return getResourceInformation(resource).getValue();
@@ -276,7 +276,7 @@ public abstract class Resource implements Comparable<Resource> {
    * @throws ResourceNotFoundException if the resource is not found
    * @throws ResourceNotFoundException if the resource is not found
    */
    */
   @Public
   @Public
-  @Evolving
+  @InterfaceStability.Unstable
   public void setResourceInformation(String resource,
   public void setResourceInformation(String resource,
       ResourceInformation resourceInformation)
       ResourceInformation resourceInformation)
       throws ResourceNotFoundException {
       throws ResourceNotFoundException {
@@ -302,8 +302,8 @@ public abstract class Resource implements Comparable<Resource> {
    * @throws ResourceNotFoundException
    * @throws ResourceNotFoundException
    *           if the resource is not found
    *           if the resource is not found
    */
    */
-  @Public
-  @Evolving
+  @InterfaceAudience.Private
+  @InterfaceStability.Unstable
   public void setResourceInformation(int index,
   public void setResourceInformation(int index,
       ResourceInformation resourceInformation)
       ResourceInformation resourceInformation)
       throws ResourceNotFoundException {
       throws ResourceNotFoundException {
@@ -323,7 +323,7 @@ public abstract class Resource implements Comparable<Resource> {
    * @throws ResourceNotFoundException if the resource is not found
    * @throws ResourceNotFoundException if the resource is not found
    */
    */
   @Public
   @Public
-  @Evolving
+  @InterfaceStability.Unstable
   public void setResourceValue(String resource, long value)
   public void setResourceValue(String resource, long value)
       throws ResourceNotFoundException {
       throws ResourceNotFoundException {
     if (resource.equals(ResourceInformation.MEMORY_URI)) {
     if (resource.equals(ResourceInformation.MEMORY_URI)) {
@@ -350,8 +350,8 @@ public abstract class Resource implements Comparable<Resource> {
    * @throws ResourceNotFoundException
    * @throws ResourceNotFoundException
    *           if the resource is not found
    *           if the resource is not found
    */
    */
-  @Public
-  @Evolving
+  @InterfaceAudience.Private
+  @InterfaceStability.Unstable
   public void setResourceValue(int index, long value)
   public void setResourceValue(int index, long value)
       throws ResourceNotFoundException {
       throws ResourceNotFoundException {
     try {
     try {

+ 5 - 4
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceRequest.java

@@ -21,6 +21,7 @@ package org.apache.hadoop.yarn.api.records;
 import java.io.Serializable;
 import java.io.Serializable;
 
 
 import org.apache.hadoop.classification.InterfaceAudience.Public;
 import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability;
 import org.apache.hadoop.classification.InterfaceStability.Evolving;
 import org.apache.hadoop.classification.InterfaceStability.Evolving;
 import org.apache.hadoop.classification.InterfaceStability.Stable;
 import org.apache.hadoop.classification.InterfaceStability.Stable;
 import org.apache.hadoop.classification.InterfaceStability.Unstable;
 import org.apache.hadoop.classification.InterfaceStability.Unstable;
@@ -103,7 +104,7 @@ public abstract class ResourceRequest implements Comparable<ResourceRequest> {
   }
   }
 
 
   @Public
   @Public
-  @Evolving
+  @Unstable
   public static ResourceRequest newInstance(Priority priority, String hostName,
   public static ResourceRequest newInstance(Priority priority, String hostName,
       Resource capability, int numContainers, boolean relaxLocality,
       Resource capability, int numContainers, boolean relaxLocality,
       String labelExpression, ExecutionTypeRequest executionTypeRequest,
       String labelExpression, ExecutionTypeRequest executionTypeRequest,
@@ -261,7 +262,7 @@ public abstract class ResourceRequest implements Comparable<ResourceRequest> {
      * @return {@link ResourceRequestBuilder}
      * @return {@link ResourceRequestBuilder}
      */
      */
     @Public
     @Public
-    @Evolving
+    @InterfaceStability.Unstable
     public ResourceRequestBuilder profileCapability(
     public ResourceRequestBuilder profileCapability(
         ProfileCapability profileCapability) {
         ProfileCapability profileCapability) {
       resourceRequest.setProfileCapability(profileCapability);
       resourceRequest.setProfileCapability(profileCapability);
@@ -486,11 +487,11 @@ public abstract class ResourceRequest implements Comparable<ResourceRequest> {
   public abstract void setNodeLabelExpression(String nodelabelExpression);
   public abstract void setNodeLabelExpression(String nodelabelExpression);
 
 
   @Public
   @Public
-  @Evolving
+  @InterfaceStability.Unstable
   public abstract ProfileCapability getProfileCapability();
   public abstract ProfileCapability getProfileCapability();
 
 
   @Public
   @Public
-  @Evolving
+  @InterfaceStability.Unstable
   public abstract void setProfileCapability(ProfileCapability p);
   public abstract void setProfileCapability(ProfileCapability p);
 
 
   /**
   /**

+ 0 - 19
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/resource/ResourceUtils.java

@@ -49,8 +49,6 @@ import java.util.concurrent.ConcurrentHashMap;
 /**
 /**
  * Helper class to read the resource-types to be supported by the system.
  * Helper class to read the resource-types to be supported by the system.
  */
  */
-@InterfaceAudience.Public
-@InterfaceStability.Unstable
 public class ResourceUtils {
 public class ResourceUtils {
 
 
   public static final String UNITS = ".units";
   public static final String UNITS = ".units";
@@ -65,7 +63,6 @@ public class ResourceUtils {
   private static final Map<String, Integer> RESOURCE_NAME_TO_INDEX =
   private static final Map<String, Integer> RESOURCE_NAME_TO_INDEX =
       new ConcurrentHashMap<String, Integer>();
       new ConcurrentHashMap<String, Integer>();
   private static volatile Map<String, ResourceInformation> resourceTypes;
   private static volatile Map<String, ResourceInformation> resourceTypes;
-  private static volatile String[] resourceNamesArray;
   private static volatile ResourceInformation[] resourceTypesArray;
   private static volatile ResourceInformation[] resourceTypesArray;
   private static volatile boolean initializedNodeResources = false;
   private static volatile boolean initializedNodeResources = false;
   private static volatile Map<String, ResourceInformation> readOnlyNodeResources;
   private static volatile Map<String, ResourceInformation> readOnlyNodeResources;
@@ -270,7 +267,6 @@ public class ResourceUtils {
 
 
   private static void updateKnownResources() {
   private static void updateKnownResources() {
     // Update resource names.
     // Update resource names.
-    resourceNamesArray = new String[resourceTypes.size()];
     resourceTypesArray = new ResourceInformation[resourceTypes.size()];
     resourceTypesArray = new ResourceInformation[resourceTypes.size()];
 
 
     int index = 2;
     int index = 2;
@@ -278,14 +274,11 @@ public class ResourceUtils {
       if (resInfo.getName().equals(MEMORY)) {
       if (resInfo.getName().equals(MEMORY)) {
         resourceTypesArray[0] = ResourceInformation
         resourceTypesArray[0] = ResourceInformation
             .newInstance(resourceTypes.get(MEMORY));
             .newInstance(resourceTypes.get(MEMORY));
-        resourceNamesArray[0] = MEMORY;
       } else if (resInfo.getName().equals(VCORES)) {
       } else if (resInfo.getName().equals(VCORES)) {
         resourceTypesArray[1] = ResourceInformation
         resourceTypesArray[1] = ResourceInformation
             .newInstance(resourceTypes.get(VCORES));
             .newInstance(resourceTypes.get(VCORES));
-        resourceNamesArray[1] = VCORES;
       } else {
       } else {
         resourceTypesArray[index] = ResourceInformation.newInstance(resInfo);
         resourceTypesArray[index] = ResourceInformation.newInstance(resInfo);
-        resourceNamesArray[index] = resInfo.getName();
         index++;
         index++;
       }
       }
     }
     }
@@ -319,18 +312,6 @@ public class ResourceUtils {
         YarnConfiguration.RESOURCE_TYPES_CONFIGURATION_FILE);
         YarnConfiguration.RESOURCE_TYPES_CONFIGURATION_FILE);
   }
   }
 
 
-  /**
-   * Get resource names array, this is mostly for performance perspective. Never
-   * modify returned array.
-   *
-   * @return resourceNamesArray
-   */
-  public static String[] getResourceNamesArray() {
-    initializeResourceTypesIfNeeded(null,
-        YarnConfiguration.RESOURCE_TYPES_CONFIGURATION_FILE);
-    return resourceNamesArray;
-  }
-
   public static ResourceInformation[] getResourceTypesArray() {
   public static ResourceInformation[] getResourceTypesArray() {
     initializeResourceTypesIfNeeded(null,
     initializeResourceTypesIfNeeded(null,
         YarnConfiguration.RESOURCE_TYPES_CONFIGURATION_FILE);
         YarnConfiguration.RESOURCE_TYPES_CONFIGURATION_FILE);

+ 1 - 5
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/resource/package-info.java

@@ -19,8 +19,4 @@
  * Package org.apache.hadoop.yarn.util.resource contains classes
  * Package org.apache.hadoop.yarn.util.resource contains classes
  * which is used as utility class for resource profile computations.
  * which is used as utility class for resource profile computations.
  */
  */
-@InterfaceAudience.Public
-@InterfaceStability.Unstable
-package org.apache.hadoop.yarn.util.resource;
-import org.apache.hadoop.classification.InterfaceAudience;
-import org.apache.hadoop.classification.InterfaceStability;
+package org.apache.hadoop.yarn.util.resource;

+ 1 - 1
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/AppInfo.java

@@ -458,7 +458,7 @@ public class AppInfo {
   public Map<String, Long> getPreemptedResourceSecondsMap() {
   public Map<String, Long> getPreemptedResourceSecondsMap() {
     return preemptedResourceSecondsMap;
     return preemptedResourceSecondsMap;
   }
   }
-  
+
   public List<ResourceRequestInfo> getResourceRequests() {
   public List<ResourceRequestInfo> getResourceRequests() {
     return this.resourceRequests;
     return this.resourceRequests;
   }
   }