Example usage for org.apache.hadoop.yarn.api.records ResourceRequest getNumContainers

List of usage examples for org.apache.hadoop.yarn.api.records ResourceRequest getNumContainers

Introduction

In this page you can find the example usage for org.apache.hadoop.yarn.api.records ResourceRequest getNumContainers.

Prototype

@Public
@Stable
public abstract int getNumContainers();

Source Link

Document

Get the number of containers required with the given specifications.

Usage

From source file:org.springframework.yarn.am.allocate.DefaultContainerAllocatorTests.java

License:Apache License

private static void assertResourceRequest(ResourceRequest req, String resourceName, Integer priority,
        Integer numContainers, Boolean relaxLocality, Integer capMemory, Integer capCores) {
    if (resourceName != null) {
        assertThat(req.getResourceName(), is(resourceName));
    }//from  w  w  w  .  j  av  a2s. c  om
    if (priority != null) {
        assertThat(req.getPriority().getPriority(), is(priority));
    }
    if (numContainers != null) {
        assertThat(req.getNumContainers(), is(numContainers));
    }
    if (relaxLocality != null) {
        assertThat(req.getRelaxLocality(), is(relaxLocality));
    }
    if (capMemory != null) {
        assertThat(req.getCapability().getMemory(), is(capMemory));
    }
    if (capCores != null) {
        assertThat(req.getCapability().getVirtualCores(), is(capCores));
    }
}

From source file:org.springframework.yarn.am.allocate.DefaultContainerAllocatorTests.java

License:Apache License

private static ResourceRequest matchRequest(List<ResourceRequest> createRequests, String name, int priority,
        int containers, boolean relax) {
    for (ResourceRequest r : createRequests) {
        if (r.getResourceName().equals(name) && r.getPriority().getPriority() == priority
                && r.getNumContainers() == containers && r.getRelaxLocality() == relax) {
            return r;
        }/*from  w w  w  . j  a va  2 s  .  c  om*/
    }
    return null;
}