From 59eab1f4c24ed43f094b8adae921872b84d428bb Mon Sep 17 00:00:00 2001 From: Arun Murthy Date: Mon, 17 Jun 2013 02:34:04 +0000 Subject: [PATCH] Merge -c 1493626 from trunk to branch-2 to fix YARN-831. Removed minimum resource from GetNewApplicationResponse as a follow-up to YARN-787. Contributed Jian He. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1493627 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-yarn-project/CHANGES.txt | 3 ++ .../GetNewApplicationResponse.java | 16 +--------- .../pb/GetNewApplicationResponsePBImpl.java | 30 +------------------ .../src/main/proto/yarn_service_protos.proto | 3 +- .../applications/distributedshell/Client.java | 14 ++------- .../resourcemanager/ClientRMService.java | 2 -- .../yarn/server/resourcemanager/TestRM.java | 1 - 7 files changed, 8 insertions(+), 61 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 457c57e27e8..fdfc055329b 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -146,6 +146,9 @@ Release 2.1.0-beta - UNRELEASED ContainerManager -> ContainerManagementProtocol (vinodkv via acmurthy) + YARN-831. Removed minimum resource from GetNewApplicationResponse as a + follow-up to YARN-787. (Jian He via acmurthy) + NEW FEATURES YARN-482. FS: Extend SchedulingMode to intermediate queues. diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetNewApplicationResponse.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetNewApplicationResponse.java index ee095b2dd53..f76e6785a4b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetNewApplicationResponse.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetNewApplicationResponse.java @@ -43,7 +43,6 @@ public abstract class GetNewApplicationResponse { GetNewApplicationResponse response = Records.newRecord(GetNewApplicationResponse.class); response.setApplicationId(applicationId); - response.setMinimumResourceCapability(minCapability); response.setMaximumResourceCapability(maxCapability); return response; } @@ -61,20 +60,7 @@ public abstract class GetNewApplicationResponse { @Private @Unstable public abstract void setApplicationId(ApplicationId applicationId); - - /** - * Get the minimum capability for any {@link Resource} allocated by the - * ResourceManager in the cluster. - * @return minimum capability of allocated resources in the cluster - */ - @Public - @Stable - public abstract Resource getMinimumResourceCapability(); - - @Private - @Unstable - public abstract void setMinimumResourceCapability(Resource capability); - + /** * Get the maximum capability for any {@link Resource} allocated by the * ResourceManager in the cluster. diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetNewApplicationResponsePBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetNewApplicationResponsePBImpl.java index 18b8a074bee..27bc1dec298 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetNewApplicationResponsePBImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetNewApplicationResponsePBImpl.java @@ -35,7 +35,6 @@ public class GetNewApplicationResponsePBImpl extends GetNewApplicationResponse { boolean viaProto = false; private ApplicationId applicationId = null; - private Resource minimumResourceCapability = null; private Resource maximumResourceCapability = null; public GetNewApplicationResponsePBImpl() { @@ -78,9 +77,6 @@ public class GetNewApplicationResponsePBImpl extends GetNewApplicationResponse { if (applicationId != null) { builder.setApplicationId(convertToProtoFormat(this.applicationId)); } - if (minimumResourceCapability != null) { - builder.setMinimumCapability(convertToProtoFormat(this.minimumResourceCapability)); - } if (maximumResourceCapability != null) { builder.setMaximumCapability(convertToProtoFormat(this.maximumResourceCapability)); } @@ -140,21 +136,6 @@ public class GetNewApplicationResponsePBImpl extends GetNewApplicationResponse { return this.maximumResourceCapability; } - @Override - public Resource getMinimumResourceCapability() { - if (this.minimumResourceCapability != null) { - return this.minimumResourceCapability; - } - - GetNewApplicationResponseProtoOrBuilder p = viaProto ? proto : builder; - if (!p.hasMinimumCapability()) { - return null; - } - - this.minimumResourceCapability = convertFromProtoFormat(p.getMinimumCapability()); - return this.minimumResourceCapability; - } - @Override public void setMaximumResourceCapability(Resource capability) { maybeInitBuilder(); @@ -163,16 +144,7 @@ public class GetNewApplicationResponsePBImpl extends GetNewApplicationResponse { } this.maximumResourceCapability = capability; } - - @Override - public void setMinimumResourceCapability(Resource capability) { - maybeInitBuilder(); - if(minimumResourceCapability == null) { - builder.clearMinimumCapability(); - } - this.minimumResourceCapability = capability; - } - + private ApplicationIdPBImpl convertFromProtoFormat(ApplicationIdProto p) { return new ApplicationIdPBImpl(p); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto index 84d5afb9c0e..81a7d951428 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto @@ -84,8 +84,7 @@ message GetNewApplicationRequestProto { message GetNewApplicationResponseProto { optional ApplicationIdProto application_id = 1; - optional ResourceProto minimumCapability = 2; - optional ResourceProto maximumCapability = 3; + optional ResourceProto maximumCapability = 2; } message GetApplicationReportRequestProto { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/Client.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/Client.java index 1fae8fdfe95..4017dc18829 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/Client.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/Client.java @@ -359,21 +359,11 @@ public class Client extends YarnClientImpl { // the required resources from the RM for the app master // Memory ask has to be a multiple of min and less than max. // Dump out information about cluster capability as seen by the resource manager - int minMem = newApp.getMinimumResourceCapability().getMemory(); int maxMem = newApp.getMaximumResourceCapability().getMemory(); - LOG.info("Min mem capabililty of resources in this cluster " + minMem); LOG.info("Max mem capabililty of resources in this cluster " + maxMem); - // A resource ask has to be atleast the minimum of the capability of the cluster, the value has to be - // a multiple of the min value and cannot exceed the max. - // If it is not an exact multiple of min, the RM will allocate to the nearest multiple of min - if (amMemory < minMem) { - LOG.info("AM memory specified below min threshold of cluster. Using min value." - + ", specified=" + amMemory - + ", min=" + minMem); - amMemory = minMem; - } - else if (amMemory > maxMem) { + // A resource ask cannot exceed the max. + if (amMemory > maxMem) { LOG.info("AM memory specified above max threshold of cluster. Using max value." + ", specified=" + amMemory + ", max=" + maxMem); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java index 3e24d366062..2a0b482454d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java @@ -208,8 +208,6 @@ public class ClientRMService extends AbstractService implements .newRecordInstance(GetNewApplicationResponse.class); response.setApplicationId(getNewApplicationId()); // Pick up min/max resource from scheduler... - response.setMinimumResourceCapability(scheduler - .getMinimumResourceCapability()); response.setMaximumResourceCapability(scheduler .getMaximumResourceCapability()); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRM.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRM.java index 295382eced7..0908b2fae86 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRM.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRM.java @@ -58,7 +58,6 @@ public class TestRM { GetNewApplicationResponse resp = rm.getNewAppId(); assert (resp.getApplicationId().getId() != 0); - assert (resp.getMinimumResourceCapability().getMemory() > 0); assert (resp.getMaximumResourceCapability().getMemory() > 0); rm.stop(); }