Example usage for org.apache.hadoop.yarn.api.records NodeReport setNodeId

List of usage examples for org.apache.hadoop.yarn.api.records NodeReport setNodeId

Introduction

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

Prototype

@Private
    @Unstable
    public abstract void setNodeId(NodeId nodeId);

Source Link

Usage

From source file:alluxio.yarn.ContainerAllocatorTest.java

License:Apache License

private ContainerAllocator setup(int numHosts, int maxContainersPerHost, int numContainers) throws Exception {
    ContainerAllocator containerAllocator = new ContainerAllocator(CONTAINER_NAME, numContainers,
            maxContainersPerHost, mResource, mYarnClient, mRMClient);
    List<NodeReport> nodeReports = new ArrayList<>();
    for (int i = 0; i < numHosts; i++) {
        NodeReport nodeReport = Records.newRecord(NodeReport.class);
        nodeReport.setNodeId(NodeId.newInstance("host" + i, 0));
        nodeReports.add(nodeReport);//from   ww  w.  j  a va2s  .c  om
    }
    when(mYarnClient.getNodeReports(Matchers.<NodeState[]>anyVararg())).thenReturn(nodeReports);
    doAnswer(allocateFirstHostAnswer(containerAllocator)).when(mRMClient)
            .addContainerRequest(any(ContainerRequest.class));
    return containerAllocator;
}