YARN-4925. ContainerRequest in AMRMClient, application should be able to specify nodes/racks together with nodeLabelExpression. Contributed by Bibin A Chundatt
This commit is contained in:
parent
ef1757790d
commit
f04c81c9ce
|
@ -712,16 +712,6 @@ public class AMRMClientImpl<T extends ContainerRequest> extends AMRMClient<T> {
|
|||
"Cannot specify more than two node labels"
|
||||
+ " in a single node label expression");
|
||||
}
|
||||
|
||||
// Don't allow specify node label against ANY request
|
||||
if ((containerRequest.getRacks() != null &&
|
||||
(!containerRequest.getRacks().isEmpty()))
|
||||
||
|
||||
(containerRequest.getNodes() != null &&
|
||||
(!containerRequest.getNodes().isEmpty()))) {
|
||||
throw new InvalidContainerRequestException(
|
||||
"Cannot specify node label with rack and node");
|
||||
}
|
||||
}
|
||||
|
||||
private void validateContainerResourceChangeRequest(
|
||||
|
|
|
@ -35,11 +35,11 @@ import java.util.Collections;
|
|||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.fs.CommonConfigurationKeys;
|
||||
import org.apache.hadoop.io.DataOutputBuffer;
|
||||
import org.apache.hadoop.io.Text;
|
||||
import org.apache.hadoop.security.Credentials;
|
||||
|
@ -713,6 +713,17 @@ public class TestAMRMClient {
|
|||
Assert.assertNull(req.getNodeLabelExpression());
|
||||
}
|
||||
}
|
||||
// set container with nodes and racks with labels
|
||||
client.addContainerRequest(new ContainerRequest(
|
||||
Resource.newInstance(1024, 1), new String[] { "rack1" },
|
||||
new String[] { "node1", "node2" }, Priority.UNDEFINED, true, "y"));
|
||||
for (ResourceRequest req : client.ask) {
|
||||
if (ResourceRequest.ANY.equals(req.getResourceName())) {
|
||||
Assert.assertEquals("y", req.getNodeLabelExpression());
|
||||
} else {
|
||||
Assert.assertNull(req.getNodeLabelExpression());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void verifyAddRequestFailed(AMRMClient<ContainerRequest> client,
|
||||
|
|
Loading…
Reference in New Issue