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 cf93d60d3f
commit 8201ed8009
2 changed files with 7 additions and 4 deletions

View File

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

View File

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