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
This commit is contained in:
Arun Murthy 2013-06-17 02:33:11 +00:00
parent 77e134d13f
commit 6b75a5c3b5
7 changed files with 8 additions and 61 deletions

View File

@ -166,6 +166,9 @@ Release 2.1.0-beta - UNRELEASED
ContainerManager -> ContainerManagementProtocol ContainerManager -> ContainerManagementProtocol
(vinodkv via acmurthy) (vinodkv via acmurthy)
YARN-831. Removed minimum resource from GetNewApplicationResponse as a
follow-up to YARN-787. (Jian He via acmurthy)
NEW FEATURES NEW FEATURES
YARN-482. FS: Extend SchedulingMode to intermediate queues. YARN-482. FS: Extend SchedulingMode to intermediate queues.

View File

@ -43,7 +43,6 @@ public abstract class GetNewApplicationResponse {
GetNewApplicationResponse response = GetNewApplicationResponse response =
Records.newRecord(GetNewApplicationResponse.class); Records.newRecord(GetNewApplicationResponse.class);
response.setApplicationId(applicationId); response.setApplicationId(applicationId);
response.setMinimumResourceCapability(minCapability);
response.setMaximumResourceCapability(maxCapability); response.setMaximumResourceCapability(maxCapability);
return response; return response;
} }
@ -61,20 +60,7 @@ public abstract class GetNewApplicationResponse {
@Private @Private
@Unstable @Unstable
public abstract void setApplicationId(ApplicationId applicationId); 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 * Get the maximum capability for any {@link Resource} allocated by the
* <code>ResourceManager</code> in the cluster. * <code>ResourceManager</code> in the cluster.

View File

@ -35,7 +35,6 @@ public class GetNewApplicationResponsePBImpl extends GetNewApplicationResponse {
boolean viaProto = false; boolean viaProto = false;
private ApplicationId applicationId = null; private ApplicationId applicationId = null;
private Resource minimumResourceCapability = null;
private Resource maximumResourceCapability = null; private Resource maximumResourceCapability = null;
public GetNewApplicationResponsePBImpl() { public GetNewApplicationResponsePBImpl() {
@ -78,9 +77,6 @@ public class GetNewApplicationResponsePBImpl extends GetNewApplicationResponse {
if (applicationId != null) { if (applicationId != null) {
builder.setApplicationId(convertToProtoFormat(this.applicationId)); builder.setApplicationId(convertToProtoFormat(this.applicationId));
} }
if (minimumResourceCapability != null) {
builder.setMinimumCapability(convertToProtoFormat(this.minimumResourceCapability));
}
if (maximumResourceCapability != null) { if (maximumResourceCapability != null) {
builder.setMaximumCapability(convertToProtoFormat(this.maximumResourceCapability)); builder.setMaximumCapability(convertToProtoFormat(this.maximumResourceCapability));
} }
@ -140,21 +136,6 @@ public class GetNewApplicationResponsePBImpl extends GetNewApplicationResponse {
return this.maximumResourceCapability; 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 @Override
public void setMaximumResourceCapability(Resource capability) { public void setMaximumResourceCapability(Resource capability) {
maybeInitBuilder(); maybeInitBuilder();
@ -163,16 +144,7 @@ public class GetNewApplicationResponsePBImpl extends GetNewApplicationResponse {
} }
this.maximumResourceCapability = capability; this.maximumResourceCapability = capability;
} }
@Override
public void setMinimumResourceCapability(Resource capability) {
maybeInitBuilder();
if(minimumResourceCapability == null) {
builder.clearMinimumCapability();
}
this.minimumResourceCapability = capability;
}
private ApplicationIdPBImpl convertFromProtoFormat(ApplicationIdProto p) { private ApplicationIdPBImpl convertFromProtoFormat(ApplicationIdProto p) {
return new ApplicationIdPBImpl(p); return new ApplicationIdPBImpl(p);
} }

View File

@ -84,8 +84,7 @@ message GetNewApplicationRequestProto {
message GetNewApplicationResponseProto { message GetNewApplicationResponseProto {
optional ApplicationIdProto application_id = 1; optional ApplicationIdProto application_id = 1;
optional ResourceProto minimumCapability = 2; optional ResourceProto maximumCapability = 2;
optional ResourceProto maximumCapability = 3;
} }
message GetApplicationReportRequestProto { message GetApplicationReportRequestProto {

View File

@ -359,21 +359,11 @@ public class Client extends YarnClientImpl {
// the required resources from the RM for the app master // the required resources from the RM for the app master
// Memory ask has to be a multiple of min and less than max. // 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 // Dump out information about cluster capability as seen by the resource manager
int minMem = newApp.getMinimumResourceCapability().getMemory();
int maxMem = newApp.getMaximumResourceCapability().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); 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 resource ask cannot exceed the max.
// a multiple of the min value and cannot exceed the max. if (amMemory > maxMem) {
// 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) {
LOG.info("AM memory specified above max threshold of cluster. Using max value." LOG.info("AM memory specified above max threshold of cluster. Using max value."
+ ", specified=" + amMemory + ", specified=" + amMemory
+ ", max=" + maxMem); + ", max=" + maxMem);

View File

@ -208,8 +208,6 @@ public class ClientRMService extends AbstractService implements
.newRecordInstance(GetNewApplicationResponse.class); .newRecordInstance(GetNewApplicationResponse.class);
response.setApplicationId(getNewApplicationId()); response.setApplicationId(getNewApplicationId());
// Pick up min/max resource from scheduler... // Pick up min/max resource from scheduler...
response.setMinimumResourceCapability(scheduler
.getMinimumResourceCapability());
response.setMaximumResourceCapability(scheduler response.setMaximumResourceCapability(scheduler
.getMaximumResourceCapability()); .getMaximumResourceCapability());

View File

@ -58,7 +58,6 @@ public class TestRM {
GetNewApplicationResponse resp = rm.getNewAppId(); GetNewApplicationResponse resp = rm.getNewAppId();
assert (resp.getApplicationId().getId() != 0); assert (resp.getApplicationId().getId() != 0);
assert (resp.getMinimumResourceCapability().getMemory() > 0);
assert (resp.getMaximumResourceCapability().getMemory() > 0); assert (resp.getMaximumResourceCapability().getMemory() > 0);
rm.stop(); rm.stop();
} }