YARN-6756. ContainerRequest#executionTypeRequest causes NPE. Contributed by Jian He

This commit is contained in:
Jian He 2017-08-29 20:35:53 -07:00
parent 9bcd64d233
commit 036cbd7453
2 changed files with 7 additions and 4 deletions

View File

@ -111,9 +111,10 @@ public abstract class AMRMClient<T extends AMRMClient.ContainerRequest> extends
private List<String> racks; private List<String> racks;
private Priority priority; private Priority priority;
private long allocationRequestId; private long allocationRequestId;
private boolean relaxLocality; private boolean relaxLocality = true;
private String nodeLabelsExpression; private String nodeLabelsExpression;
private ExecutionTypeRequest executionTypeRequest; private ExecutionTypeRequest executionTypeRequest =
ExecutionTypeRequest.newInstance();
/** /**
* Instantiates a {@link ContainerRequest} with the given constraints and * Instantiates a {@link ContainerRequest} with the given constraints and

View File

@ -51,8 +51,10 @@ public class TestAMRMClientContainerRequest {
Resource capability = Resource.newInstance(1024, 1); Resource capability = Resource.newInstance(1024, 1);
ContainerRequest request = ContainerRequest request =
new ContainerRequest(capability, new String[] {"host1", "host2"}, ContainerRequest.newBuilder().capability(capability)
new String[] {"/rack2"}, Priority.newInstance(1)); .nodes(new String[] { "host1", "host2" })
.racks(new String[] { "/rack2" }).priority(Priority.newInstance(1))
.build();
client.addContainerRequest(request); client.addContainerRequest(request);
verifyResourceRequest(client, request, "host1", true); verifyResourceRequest(client, request, "host1", true);
verifyResourceRequest(client, request, "host2", true); verifyResourceRequest(client, request, "host2", true);