Example usage for org.apache.hadoop.yarn.api.records NodeId setHost

List of usage examples for org.apache.hadoop.yarn.api.records NodeId setHost

Introduction

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

Prototype

@Private
    @Unstable
    protected abstract void setHost(String host);

Source Link

Usage

From source file:org.apache.tajo.worker.TaskRunnerTest.java

License:Apache License

public void testInit() throws Exception {
    ProtoAsyncRpcClient mockClient = mock(ProtoAsyncRpcClient.class);
    mockClient.close();//from www.j a v a  2 s.  c o m

    MasterWorkerProtocolService.Interface mockMaster = mock(MasterWorkerProtocolService.Interface.class);
    ApplicationAttemptId appAttemptId = BuilderUtils.newApplicationAttemptId(q1.getApplicationId(),
            q1.getAttemptId());
    ContainerId cId = BuilderUtils.newContainerId(appAttemptId, 1);

    NodeId nodeId = RecordFactoryProvider.getRecordFactory(null).newRecordInstance(NodeId.class);
    nodeId.setHost("host1");
    nodeId.setPort(9001);
    UserGroupInformation mockTaskOwner = mock(UserGroupInformation.class);
    when(mockTaskOwner.getShortUserName()).thenReturn("hyunsik");
    TaskRunner runner = new TaskRunner(sq1, nodeId, mockTaskOwner, mockMaster, cId);
    QueryConf conf = new QueryConf();
    conf.setOutputPath(new Path("/tmp/" + q1));
    runner.init(conf);
    runner.start();
    runner.stop();
}

From source file:org.springframework.yarn.examples.grid.yarn.YarnManagedContainerGroupsTests.java

License:Apache License

/**
 * Mocks a yarn container with hostname hostname1 and container id {@link #CID1}
 *
 * @return the mocked Yarn Container//from   w ww  . ja  v  a2s . c om
 */
private Container mockContainer1() {
    Container container = Records.newRecord(Container.class);
    NodeId nodeId = Records.newRecord(NodeId.class);
    nodeId.setHost(HOST1);
    container.setNodeId(nodeId);
    ContainerId containerId = ConverterUtils.toContainerId(CID1);
    container.setId(containerId);
    return container;
}

From source file:org.springframework.yarn.examples.grid.yarn.YarnManagedContainerGroupsTests.java

License:Apache License

/**
 * Mocks a yarn container with hostname hostname2 and container id {@link #CID2}
 *
 * @return the mocked Yarn Container//ww  w .jav a  2 s  . c  om
 */
private Container mockContainer2() {
    Container container = Records.newRecord(Container.class);
    NodeId nodeId = Records.newRecord(NodeId.class);
    nodeId.setHost(HOST2);
    container.setNodeId(nodeId);
    ContainerId containerId = ConverterUtils.toContainerId(CID2);
    container.setId(containerId);
    return container;
}

From source file:org.springframework.yarn.examples.grid.yarn.YarnManagedContainerGroupsTests.java

License:Apache License

/**
 * Mocks a yarn container with hostname hostname3 and container id {@link #CID3}
 *
 * @return the mocked Yarn Container//w w  w.  jav  a 2  s  .c o m
 */
private Container mockContainer3() {
    Container container = Records.newRecord(Container.class);
    NodeId nodeId = Records.newRecord(NodeId.class);
    nodeId.setHost(HOST3);
    container.setNodeId(nodeId);
    ContainerId containerId = ConverterUtils.toContainerId(CID3);
    container.setId(containerId);
    return container;
}