Skip to content

Commit d7fa7e2

Browse files
committed
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/trunk@1493626 13f79535-47bb-0310-9956-ffa450edef68
1 parent 47383ad commit d7fa7e2

File tree

7 files changed

+8
-61
lines changed

7 files changed

+8
-61
lines changed

hadoop-yarn-project/CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ Release 2.1.0-beta - UNRELEASED
166166
ContainerManager -> ContainerManagementProtocol
167167
(vinodkv via acmurthy)
168168

169+
YARN-831. Removed minimum resource from GetNewApplicationResponse as a
170+
follow-up to YARN-787. (Jian He via acmurthy)
171+
169172
NEW FEATURES
170173

171174
YARN-482. FS: Extend SchedulingMode to intermediate queues.

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetNewApplicationResponse.java

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ public static GetNewApplicationResponse newInstance(
4343
GetNewApplicationResponse response =
4444
Records.newRecord(GetNewApplicationResponse.class);
4545
response.setApplicationId(applicationId);
46-
response.setMinimumResourceCapability(minCapability);
4746
response.setMaximumResourceCapability(maxCapability);
4847
return response;
4948
}
@@ -61,20 +60,7 @@ public static GetNewApplicationResponse newInstance(
6160
@Private
6261
@Unstable
6362
public abstract void setApplicationId(ApplicationId applicationId);
64-
65-
/**
66-
* Get the minimum capability for any {@link Resource} allocated by the
67-
* <code>ResourceManager</code> in the cluster.
68-
* @return minimum capability of allocated resources in the cluster
69-
*/
70-
@Public
71-
@Stable
72-
public abstract Resource getMinimumResourceCapability();
73-
74-
@Private
75-
@Unstable
76-
public abstract void setMinimumResourceCapability(Resource capability);
77-
63+
7864
/**
7965
* Get the maximum capability for any {@link Resource} allocated by the
8066
* <code>ResourceManager</code> in the cluster.

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetNewApplicationResponsePBImpl.java

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ public class GetNewApplicationResponsePBImpl extends GetNewApplicationResponse {
3535
boolean viaProto = false;
3636

3737
private ApplicationId applicationId = null;
38-
private Resource minimumResourceCapability = null;
3938
private Resource maximumResourceCapability = null;
4039

4140
public GetNewApplicationResponsePBImpl() {
@@ -78,9 +77,6 @@ private void mergeLocalToBuilder() {
7877
if (applicationId != null) {
7978
builder.setApplicationId(convertToProtoFormat(this.applicationId));
8079
}
81-
if (minimumResourceCapability != null) {
82-
builder.setMinimumCapability(convertToProtoFormat(this.minimumResourceCapability));
83-
}
8480
if (maximumResourceCapability != null) {
8581
builder.setMaximumCapability(convertToProtoFormat(this.maximumResourceCapability));
8682
}
@@ -140,21 +136,6 @@ public Resource getMaximumResourceCapability() {
140136
return this.maximumResourceCapability;
141137
}
142138

143-
@Override
144-
public Resource getMinimumResourceCapability() {
145-
if (this.minimumResourceCapability != null) {
146-
return this.minimumResourceCapability;
147-
}
148-
149-
GetNewApplicationResponseProtoOrBuilder p = viaProto ? proto : builder;
150-
if (!p.hasMinimumCapability()) {
151-
return null;
152-
}
153-
154-
this.minimumResourceCapability = convertFromProtoFormat(p.getMinimumCapability());
155-
return this.minimumResourceCapability;
156-
}
157-
158139
@Override
159140
public void setMaximumResourceCapability(Resource capability) {
160141
maybeInitBuilder();
@@ -163,16 +144,7 @@ public void setMaximumResourceCapability(Resource capability) {
163144
}
164145
this.maximumResourceCapability = capability;
165146
}
166-
167-
@Override
168-
public void setMinimumResourceCapability(Resource capability) {
169-
maybeInitBuilder();
170-
if(minimumResourceCapability == null) {
171-
builder.clearMinimumCapability();
172-
}
173-
this.minimumResourceCapability = capability;
174-
}
175-
147+
176148
private ApplicationIdPBImpl convertFromProtoFormat(ApplicationIdProto p) {
177149
return new ApplicationIdPBImpl(p);
178150
}

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ message GetNewApplicationRequestProto {
8484

8585
message GetNewApplicationResponseProto {
8686
optional ApplicationIdProto application_id = 1;
87-
optional ResourceProto minimumCapability = 2;
88-
optional ResourceProto maximumCapability = 3;
87+
optional ResourceProto maximumCapability = 2;
8988
}
9089

9190
message GetApplicationReportRequestProto {

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/Client.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -359,21 +359,11 @@ public boolean run() throws IOException, YarnException {
359359
// the required resources from the RM for the app master
360360
// Memory ask has to be a multiple of min and less than max.
361361
// Dump out information about cluster capability as seen by the resource manager
362-
int minMem = newApp.getMinimumResourceCapability().getMemory();
363362
int maxMem = newApp.getMaximumResourceCapability().getMemory();
364-
LOG.info("Min mem capabililty of resources in this cluster " + minMem);
365363
LOG.info("Max mem capabililty of resources in this cluster " + maxMem);
366364

367-
// A resource ask has to be atleast the minimum of the capability of the cluster, the value has to be
368-
// a multiple of the min value and cannot exceed the max.
369-
// If it is not an exact multiple of min, the RM will allocate to the nearest multiple of min
370-
if (amMemory < minMem) {
371-
LOG.info("AM memory specified below min threshold of cluster. Using min value."
372-
+ ", specified=" + amMemory
373-
+ ", min=" + minMem);
374-
amMemory = minMem;
375-
}
376-
else if (amMemory > maxMem) {
365+
// A resource ask cannot exceed the max.
366+
if (amMemory > maxMem) {
377367
LOG.info("AM memory specified above max threshold of cluster. Using max value."
378368
+ ", specified=" + amMemory
379369
+ ", max=" + maxMem);

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,6 @@ public GetNewApplicationResponse getNewApplication(
208208
.newRecordInstance(GetNewApplicationResponse.class);
209209
response.setApplicationId(getNewApplicationId());
210210
// Pick up min/max resource from scheduler...
211-
response.setMinimumResourceCapability(scheduler
212-
.getMinimumResourceCapability());
213211
response.setMaximumResourceCapability(scheduler
214212
.getMaximumResourceCapability());
215213

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRM.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ public void testGetNewAppId() throws Exception {
5858

5959
GetNewApplicationResponse resp = rm.getNewAppId();
6060
assert (resp.getApplicationId().getId() != 0);
61-
assert (resp.getMinimumResourceCapability().getMemory() > 0);
6261
assert (resp.getMaximumResourceCapability().getMemory() > 0);
6362
rm.stop();
6463
}

0 commit comments

Comments
 (0)