YARN-787. Removed minimum resource from RegisterApplicationMasterResponse. Contributed by Alejandro Abdelnur.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1493509 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Arun Murthy 2013-06-16 13:59:41 +00:00
parent 18a4cb4872
commit 98d97d316c
14 changed files with 18 additions and 96 deletions

View File

@ -122,6 +122,7 @@ import org.apache.hadoop.yarn.api.records.LocalResourceVisibility;
import org.apache.hadoop.yarn.api.records.NodeId; import org.apache.hadoop.yarn.api.records.NodeId;
import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.api.records.URL; import org.apache.hadoop.yarn.api.records.URL;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.event.EventHandler; import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException; import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
import org.apache.hadoop.yarn.factories.RecordFactory; import org.apache.hadoop.yarn.factories.RecordFactory;
@ -1245,9 +1246,9 @@ public abstract class TaskAttemptImpl implements
int slotMemoryReq = int slotMemoryReq =
taskAttempt.getMemoryRequired(taskAttempt.conf, taskType); taskAttempt.getMemoryRequired(taskAttempt.conf, taskType);
int minSlotMemSize = int minSlotMemSize = taskAttempt.conf.getInt(
taskAttempt.appContext.getClusterInfo().getMinContainerCapability() YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB,
.getMemory(); YarnConfiguration.DEFAULT_RM_SCHEDULER_MINIMUM_ALLOCATION_MB);
int simSlotsRequired = int simSlotsRequired =
minSlotMemSize == 0 ? 0 : (int) Math.ceil((float) slotMemoryReq minSlotMemSize == 0 ? 0 : (int) Math.ceil((float) slotMemoryReq

View File

@ -220,13 +220,9 @@ public class MRApp extends MRAppMaster {
super.serviceInit(conf); super.serviceInit(conf);
if (this.clusterInfo != null) { if (this.clusterInfo != null) {
getContext().getClusterInfo().setMinContainerCapability(
this.clusterInfo.getMinContainerCapability());
getContext().getClusterInfo().setMaxContainerCapability( getContext().getClusterInfo().setMaxContainerCapability(
this.clusterInfo.getMaxContainerCapability()); this.clusterInfo.getMaxContainerCapability());
} else { } else {
getContext().getClusterInfo().setMinContainerCapability(
Resource.newInstance(1024, 1));
getContext().getClusterInfo().setMaxContainerCapability( getContext().getClusterInfo().setMaxContainerCapability(
Resource.newInstance(10240, 1)); Resource.newInstance(10240, 1));
} }

View File

@ -204,8 +204,6 @@ public class MRAppBenchmark {
throws IOException { throws IOException {
RegisterApplicationMasterResponse response = RegisterApplicationMasterResponse response =
Records.newRecord(RegisterApplicationMasterResponse.class); Records.newRecord(RegisterApplicationMasterResponse.class);
response.setMinimumResourceCapability(Resource.newInstance(
1024, 1));
response.setMaximumResourceCapability(Resource.newInstance( response.setMaximumResourceCapability(Resource.newInstance(
10240, 1)); 10240, 1));
return response; return response;

View File

@ -1329,8 +1329,7 @@ public class TestRMContainerAllocator {
when(context.getApplicationAttemptId()).thenReturn(appAttemptId); when(context.getApplicationAttemptId()).thenReturn(appAttemptId);
when(context.getJob(isA(JobId.class))).thenReturn(job); when(context.getJob(isA(JobId.class))).thenReturn(job);
when(context.getClusterInfo()).thenReturn( when(context.getClusterInfo()).thenReturn(
new ClusterInfo(Resource.newInstance(1024, 1), Resource.newInstance( new ClusterInfo(Resource.newInstance(10240, 1)));
10240, 1)));
when(context.getEventHandler()).thenReturn(new EventHandler() { when(context.getEventHandler()).thenReturn(new EventHandler() {
@Override @Override
public void handle(Event event) { public void handle(Event event) {

View File

@ -1424,8 +1424,6 @@ public class TestRecovery {
when(minContainerRequirements.getMemory()).thenReturn(1000); when(minContainerRequirements.getMemory()).thenReturn(1000);
ClusterInfo clusterInfo = mock(ClusterInfo.class); ClusterInfo clusterInfo = mock(ClusterInfo.class);
when(clusterInfo.getMinContainerCapability()).thenReturn(
minContainerRequirements);
AppContext appContext = mock(AppContext.class); AppContext appContext = mock(AppContext.class);
when(appContext.getClusterInfo()).thenReturn(clusterInfo); when(appContext.getClusterInfo()).thenReturn(clusterInfo);

View File

@ -82,6 +82,7 @@ import org.apache.hadoop.yarn.api.records.Container;
import org.apache.hadoop.yarn.api.records.ContainerId; import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.NodeId; import org.apache.hadoop.yarn.api.records.NodeId;
import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.event.Event; import org.apache.hadoop.yarn.event.Event;
import org.apache.hadoop.yarn.event.EventHandler; import org.apache.hadoop.yarn.event.EventHandler;
import org.junit.Test; import org.junit.Test;
@ -197,8 +198,9 @@ public class TestTaskAttempt{
Configuration conf = new Configuration(); Configuration conf = new Configuration();
conf.setInt(MRJobConfig.MAP_MEMORY_MB, mapMemMb); conf.setInt(MRJobConfig.MAP_MEMORY_MB, mapMemMb);
conf.setInt(MRJobConfig.REDUCE_MEMORY_MB, reduceMemMb); conf.setInt(MRJobConfig.REDUCE_MEMORY_MB, reduceMemMb);
app.setClusterInfo(new ClusterInfo(Resource conf.setInt(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB,
.newInstance(minContainerSize, 1), Resource.newInstance(10240, 1))); minContainerSize);
app.setClusterInfo(new ClusterInfo(Resource.newInstance(10240, 1)));
Job job = app.submit(conf); Job job = app.submit(conf);
app.waitForState(job, JobState.RUNNING); app.waitForState(job, JobState.RUNNING);
@ -392,7 +394,6 @@ public class TestTaskAttempt{
ClusterInfo clusterInfo = mock(ClusterInfo.class); ClusterInfo clusterInfo = mock(ClusterInfo.class);
Resource resource = mock(Resource.class); Resource resource = mock(Resource.class);
when(appCtx.getClusterInfo()).thenReturn(clusterInfo); when(appCtx.getClusterInfo()).thenReturn(clusterInfo);
when(clusterInfo.getMinContainerCapability()).thenReturn(resource);
when(resource.getMemory()).thenReturn(1024); when(resource.getMemory()).thenReturn(1024);
TaskAttemptImpl taImpl = TaskAttemptImpl taImpl =
@ -450,7 +451,6 @@ public class TestTaskAttempt{
ClusterInfo clusterInfo = mock(ClusterInfo.class); ClusterInfo clusterInfo = mock(ClusterInfo.class);
Resource resource = mock(Resource.class); Resource resource = mock(Resource.class);
when(appCtx.getClusterInfo()).thenReturn(clusterInfo); when(appCtx.getClusterInfo()).thenReturn(clusterInfo);
when(clusterInfo.getMinContainerCapability()).thenReturn(resource);
when(resource.getMemory()).thenReturn(1024); when(resource.getMemory()).thenReturn(1024);
TaskAttemptImpl taImpl = TaskAttemptImpl taImpl =
@ -511,7 +511,6 @@ public class TestTaskAttempt{
ClusterInfo clusterInfo = mock(ClusterInfo.class); ClusterInfo clusterInfo = mock(ClusterInfo.class);
Resource resource = mock(Resource.class); Resource resource = mock(Resource.class);
when(appCtx.getClusterInfo()).thenReturn(clusterInfo); when(appCtx.getClusterInfo()).thenReturn(clusterInfo);
when(clusterInfo.getMinContainerCapability()).thenReturn(resource);
when(resource.getMemory()).thenReturn(1024); when(resource.getMemory()).thenReturn(1024);
TaskAttemptImpl taImpl = TaskAttemptImpl taImpl =
@ -579,7 +578,6 @@ public class TestTaskAttempt{
ClusterInfo clusterInfo = mock(ClusterInfo.class); ClusterInfo clusterInfo = mock(ClusterInfo.class);
Resource resource = mock(Resource.class); Resource resource = mock(Resource.class);
when(appCtx.getClusterInfo()).thenReturn(clusterInfo); when(appCtx.getClusterInfo()).thenReturn(clusterInfo);
when(clusterInfo.getMinContainerCapability()).thenReturn(resource);
when(resource.getMemory()).thenReturn(1024); when(resource.getMemory()).thenReturn(1024);
TaskAttemptImpl taImpl = new MapTaskAttemptImpl(taskId, 1, eventHandler, TaskAttemptImpl taImpl = new MapTaskAttemptImpl(taskId, 1, eventHandler,
@ -629,7 +627,6 @@ public class TestTaskAttempt{
ClusterInfo clusterInfo = mock(ClusterInfo.class); ClusterInfo clusterInfo = mock(ClusterInfo.class);
Resource resource = mock(Resource.class); Resource resource = mock(Resource.class);
when(appCtx.getClusterInfo()).thenReturn(clusterInfo); when(appCtx.getClusterInfo()).thenReturn(clusterInfo);
when(clusterInfo.getMinContainerCapability()).thenReturn(resource);
when(resource.getMemory()).thenReturn(1024); when(resource.getMemory()).thenReturn(1024);
TaskAttemptImpl taImpl = new MapTaskAttemptImpl(taskId, 1, eventHandler, TaskAttemptImpl taImpl = new MapTaskAttemptImpl(taskId, 1, eventHandler,

View File

@ -117,8 +117,7 @@ public class TestLocalContainerAllocator {
when(ctx.getApplicationAttemptId()).thenReturn(attemptId); when(ctx.getApplicationAttemptId()).thenReturn(attemptId);
when(ctx.getJob(isA(JobId.class))).thenReturn(job); when(ctx.getJob(isA(JobId.class))).thenReturn(job);
when(ctx.getClusterInfo()).thenReturn( when(ctx.getClusterInfo()).thenReturn(
new ClusterInfo(Resource.newInstance(1024, 1), Resource.newInstance( new ClusterInfo(Resource.newInstance(10240, 1)));
10240, 1)));
when(ctx.getEventHandler()).thenReturn(eventHandler); when(ctx.getEventHandler()).thenReturn(eventHandler);
return ctx; return ctx;
} }

View File

@ -149,6 +149,9 @@ Release 2.1.0-beta - UNRELEASED
YARN-821. Renamed setFinishApplicationStatus to setFinalApplicationStatus in YARN-821. Renamed setFinishApplicationStatus to setFinalApplicationStatus in
FinishApplicationMasterRequest for consistency. (Jian He via vinodk) FinishApplicationMasterRequest for consistency. (Jian He via vinodk)
YARN-787. Removed minimum resource from RegisterApplicationMasterResponse.
(tucu via acmurthy)
NEW FEATURES NEW FEATURES
YARN-482. FS: Extend SchedulingMode to intermediate queues. YARN-482. FS: Extend SchedulingMode to intermediate queues.

View File

@ -51,24 +51,10 @@ public abstract class RegisterApplicationMasterResponse {
Map<ApplicationAccessType, String> acls) { Map<ApplicationAccessType, String> acls) {
RegisterApplicationMasterResponse response = RegisterApplicationMasterResponse response =
Records.newRecord(RegisterApplicationMasterResponse.class); Records.newRecord(RegisterApplicationMasterResponse.class);
response.setMinimumResourceCapability(minCapability);
response.setMaximumResourceCapability(maxCapability); response.setMaximumResourceCapability(maxCapability);
response.setApplicationACLs(acls); response.setApplicationACLs(acls);
return response; return response;
} }
/**
* 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

View File

@ -42,7 +42,6 @@ public class RegisterApplicationMasterResponsePBImpl extends
RegisterApplicationMasterResponseProto.Builder builder = null; RegisterApplicationMasterResponseProto.Builder builder = null;
boolean viaProto = false; boolean viaProto = false;
private Resource minimumResourceCapability;
private Resource maximumResourceCapability; private Resource maximumResourceCapability;
private Map<ApplicationAccessType, String> applicationACLS = null; private Map<ApplicationAccessType, String> applicationACLS = null;
@ -91,10 +90,6 @@ public class RegisterApplicationMasterResponsePBImpl extends
} }
private void mergeLocalToBuilder() { private void mergeLocalToBuilder() {
if (this.minimumResourceCapability != null) {
builder.setMinimumCapability(
convertToProtoFormat(this.minimumResourceCapability));
}
if (this.maximumResourceCapability != null) { if (this.maximumResourceCapability != null) {
builder.setMaximumCapability( builder.setMaximumCapability(
convertToProtoFormat(this.maximumResourceCapability)); convertToProtoFormat(this.maximumResourceCapability));
@ -127,21 +122,6 @@ public class RegisterApplicationMasterResponsePBImpl extends
return this.maximumResourceCapability; return this.maximumResourceCapability;
} }
@Override
public Resource getMinimumResourceCapability() {
if (this.minimumResourceCapability != null) {
return this.minimumResourceCapability;
}
RegisterApplicationMasterResponseProtoOrBuilder 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();
@ -151,16 +131,6 @@ public class RegisterApplicationMasterResponsePBImpl extends
this.maximumResourceCapability = capability; this.maximumResourceCapability = capability;
} }
@Override
public void setMinimumResourceCapability(Resource capability) {
maybeInitBuilder();
if(minimumResourceCapability == null) {
builder.clearMinimumCapability();
}
this.minimumResourceCapability = capability;
}
@Override @Override
public Map<ApplicationAccessType, String> getApplicationACLs() { public Map<ApplicationAccessType, String> getApplicationACLs() {
initApplicationACLs(); initApplicationACLs();

View File

@ -35,9 +35,8 @@ message RegisterApplicationMasterRequestProto {
} }
message RegisterApplicationMasterResponseProto { message RegisterApplicationMasterResponseProto {
optional ResourceProto minimumCapability = 1; optional ResourceProto maximumCapability = 1;
optional ResourceProto maximumCapability = 2; repeated ApplicationACLMapProto application_ACLs = 2;
repeated ApplicationACLMapProto application_ACLs = 3;
} }
message FinishApplicationMasterRequestProto { message FinishApplicationMasterRequestProto {

View File

@ -463,22 +463,11 @@ public class ApplicationMaster {
appMasterTrackingUrl); appMasterTrackingUrl);
// Dump out information about cluster capability as seen by the // Dump out information about cluster capability as seen by the
// resource manager // resource manager
int minMem = response.getMinimumResourceCapability().getMemory();
int maxMem = response.getMaximumResourceCapability().getMemory(); int maxMem = response.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 // A resource ask cannot exceed the max.
// cluster, the value has to be a multiple of the min value and cannot if (containerMemory > maxMem) {
// exceed the max.
// If it is not an exact multiple of min, the RM will allocate to the
// nearest multiple of min
if (containerMemory < minMem) {
LOG.info("Container memory specified below min threshold of cluster."
+ " Using min value." + ", specified=" + containerMemory + ", min="
+ minMem);
containerMemory = minMem;
} else if (containerMemory > maxMem) {
LOG.info("Container memory specified above max threshold of cluster." LOG.info("Container memory specified above max threshold of cluster."
+ " Using max value." + ", specified=" + containerMemory + ", max=" + " Using max value." + ", specified=" + containerMemory + ", max="
+ maxMem); + maxMem);

View File

@ -22,27 +22,16 @@ import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.util.Records; import org.apache.hadoop.yarn.util.Records;
public class ClusterInfo { public class ClusterInfo {
private Resource minContainerCapability;
private Resource maxContainerCapability; private Resource maxContainerCapability;
public ClusterInfo() { public ClusterInfo() {
this.minContainerCapability = Records.newRecord(Resource.class);
this.maxContainerCapability = Records.newRecord(Resource.class); this.maxContainerCapability = Records.newRecord(Resource.class);
} }
public ClusterInfo(Resource minCapability, Resource maxCapability) { public ClusterInfo(Resource maxCapability) {
this.minContainerCapability = minCapability;
this.maxContainerCapability = maxCapability; this.maxContainerCapability = maxCapability;
} }
public Resource getMinContainerCapability() {
return minContainerCapability;
}
public void setMinContainerCapability(Resource minContainerCapability) {
this.minContainerCapability = minContainerCapability;
}
public Resource getMaxContainerCapability() { public Resource getMaxContainerCapability() {
return maxContainerCapability; return maxContainerCapability;
} }

View File

@ -210,8 +210,6 @@ public class ApplicationMasterService extends AbstractService implements
// Pick up min/max resource from scheduler... // Pick up min/max resource from scheduler...
RegisterApplicationMasterResponse response = recordFactory RegisterApplicationMasterResponse response = recordFactory
.newRecordInstance(RegisterApplicationMasterResponse.class); .newRecordInstance(RegisterApplicationMasterResponse.class);
response.setMinimumResourceCapability(rScheduler
.getMinimumResourceCapability());
response.setMaximumResourceCapability(rScheduler response.setMaximumResourceCapability(rScheduler
.getMaximumResourceCapability()); .getMaximumResourceCapability());
response.setApplicationACLs(app.getRMAppAttempt(applicationAttemptId) response.setApplicationACLs(app.getRMAppAttempt(applicationAttemptId)