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
This commit is contained in:
Arun Murthy 2013-06-17 02:34:04 +00:00
parent 68807a65c2
commit 59eab1f4c2
7 changed files with 8 additions and 61 deletions

View File

@ -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.

View File

@ -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
* <code>ResourceManager</code> 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
* <code>ResourceManager</code> in the cluster.

View File

@ -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);
}

View File

@ -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 {

View File

@ -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);

View File

@ -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());

View File

@ -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();
}