From da0b6a354bf6f6bf37ca5a05a4a8eece09aa4893 Mon Sep 17 00:00:00 2001 From: Sunil G Date: Tue, 12 Sep 2017 20:31:47 +0530 Subject: [PATCH] YARN-7137. [YARN-3926] Move newly added APIs to unstable in YARN-3926 branch. Contributed by Wangda Tan. --- .../hadoop/yarn/api/records/Resource.java | 24 +++++++++---------- .../yarn/api/records/ResourceRequest.java | 9 +++---- .../yarn/util/resource/ResourceUtils.java | 19 --------------- .../yarn/util/resource/package-info.java | 6 +---- .../resourcemanager/webapp/dao/AppInfo.java | 2 +- 5 files changed, 19 insertions(+), 41 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java index bf6b55ce7e..acd0e6006b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java @@ -206,8 +206,8 @@ public void setMemorySize(long memory) { * * @return Map of resource name to ResourceInformation */ - @Public - @Evolving + @InterfaceAudience.Private + @InterfaceStability.Unstable public ResourceInformation[] getResources() { return resources; } @@ -220,7 +220,7 @@ public ResourceInformation[] getResources() { * @throws ResourceNotFoundException if the resource can't be found */ @Public - @Evolving + @InterfaceStability.Unstable public ResourceInformation getResourceInformation(String resource) throws ResourceNotFoundException { Integer index = ResourceUtils.getResourceTypeIndex().get(resource); @@ -240,8 +240,8 @@ public ResourceInformation getResourceInformation(String resource) * @throws ResourceNotFoundException * if the resource can't be found */ - @Public - @Evolving + @InterfaceAudience.Private + @InterfaceStability.Unstable public ResourceInformation getResourceInformation(int index) throws ResourceNotFoundException { ResourceInformation ri = null; @@ -262,7 +262,7 @@ public ResourceInformation getResourceInformation(int index) * @throws ResourceNotFoundException if the resource can't be found */ @Public - @Evolving + @InterfaceStability.Unstable public long getResourceValue(String resource) throws ResourceNotFoundException { return getResourceInformation(resource).getValue(); @@ -276,7 +276,7 @@ public long getResourceValue(String resource) * @throws ResourceNotFoundException if the resource is not found */ @Public - @Evolving + @InterfaceStability.Unstable public void setResourceInformation(String resource, ResourceInformation resourceInformation) throws ResourceNotFoundException { @@ -302,8 +302,8 @@ public void setResourceInformation(String resource, * @throws ResourceNotFoundException * if the resource is not found */ - @Public - @Evolving + @InterfaceAudience.Private + @InterfaceStability.Unstable public void setResourceInformation(int index, ResourceInformation resourceInformation) throws ResourceNotFoundException { @@ -323,7 +323,7 @@ public void setResourceInformation(int index, * @throws ResourceNotFoundException if the resource is not found */ @Public - @Evolving + @InterfaceStability.Unstable public void setResourceValue(String resource, long value) throws ResourceNotFoundException { if (resource.equals(ResourceInformation.MEMORY_URI)) { @@ -350,8 +350,8 @@ public void setResourceValue(String resource, long value) * @throws ResourceNotFoundException * if the resource is not found */ - @Public - @Evolving + @InterfaceAudience.Private + @InterfaceStability.Unstable public void setResourceValue(int index, long value) throws ResourceNotFoundException { try { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceRequest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceRequest.java index c1339b00b1..21fa15f14a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceRequest.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceRequest.java @@ -21,6 +21,7 @@ import java.io.Serializable; 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.Stable; import org.apache.hadoop.classification.InterfaceStability.Unstable; @@ -103,7 +104,7 @@ public static ResourceRequest newInstance(Priority priority, String hostName, } @Public - @Evolving + @Unstable public static ResourceRequest newInstance(Priority priority, String hostName, Resource capability, int numContainers, boolean relaxLocality, String labelExpression, ExecutionTypeRequest executionTypeRequest, @@ -261,7 +262,7 @@ public ResourceRequestBuilder allocationRequestId( * @return {@link ResourceRequestBuilder} */ @Public - @Evolving + @InterfaceStability.Unstable public ResourceRequestBuilder profileCapability( ProfileCapability profileCapability) { resourceRequest.setProfileCapability(profileCapability); @@ -486,11 +487,11 @@ public ExecutionTypeRequest getExecutionTypeRequest() { public abstract void setNodeLabelExpression(String nodelabelExpression); @Public - @Evolving + @InterfaceStability.Unstable public abstract ProfileCapability getProfileCapability(); @Public - @Evolving + @InterfaceStability.Unstable public abstract void setProfileCapability(ProfileCapability p); /** diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/resource/ResourceUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/resource/ResourceUtils.java index 110453abde..1da5d6afb0 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/resource/ResourceUtils.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/resource/ResourceUtils.java @@ -49,8 +49,6 @@ /** * Helper class to read the resource-types to be supported by the system. */ -@InterfaceAudience.Public -@InterfaceStability.Unstable public class ResourceUtils { public static final String UNITS = ".units"; @@ -65,7 +63,6 @@ public class ResourceUtils { private static final Map RESOURCE_NAME_TO_INDEX = new ConcurrentHashMap(); private static volatile Map resourceTypes; - private static volatile String[] resourceNamesArray; private static volatile ResourceInformation[] resourceTypesArray; private static volatile boolean initializedNodeResources = false; private static volatile Map readOnlyNodeResources; @@ -270,7 +267,6 @@ public static void initializeResourcesFromResourceInformationMap( private static void updateKnownResources() { // Update resource names. - resourceNamesArray = new String[resourceTypes.size()]; resourceTypesArray = new ResourceInformation[resourceTypes.size()]; int index = 2; @@ -278,14 +274,11 @@ private static void updateKnownResources() { if (resInfo.getName().equals(MEMORY)) { resourceTypesArray[0] = ResourceInformation .newInstance(resourceTypes.get(MEMORY)); - resourceNamesArray[0] = MEMORY; } else if (resInfo.getName().equals(VCORES)) { resourceTypesArray[1] = ResourceInformation .newInstance(resourceTypes.get(VCORES)); - resourceNamesArray[1] = VCORES; } else { resourceTypesArray[index] = ResourceInformation.newInstance(resInfo); - resourceNamesArray[index] = resInfo.getName(); index++; } } @@ -319,18 +312,6 @@ public static Map getResourceTypes() { 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() { initializeResourceTypesIfNeeded(null, YarnConfiguration.RESOURCE_TYPES_CONFIGURATION_FILE); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/resource/package-info.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/resource/package-info.java index 1e925d7d57..d7c799d7cb 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/resource/package-info.java +++ b/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 * 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; \ No newline at end of file +package org.apache.hadoop.yarn.util.resource; \ No newline at end of file diff --git a/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 b/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 index ed3344a96e..236c467765 100644 --- a/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 +++ b/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 long getPreemptedVcoreSeconds() { public Map getPreemptedResourceSecondsMap() { return preemptedResourceSecondsMap; } - + public List getResourceRequests() { return this.resourceRequests; }