diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/AMRMClient.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/AMRMClient.java index bc4173f6daa..1c3ac1c7bff 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/AMRMClient.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/AMRMClient.java @@ -111,9 +111,10 @@ public abstract class AMRMClient extends private List 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 diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestAMRMClientContainerRequest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestAMRMClientContainerRequest.java index ad18da3c53f..96035394ec7 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestAMRMClientContainerRequest.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestAMRMClientContainerRequest.java @@ -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);