Search in sources :

Example 1 with NMContainerStatusPBImpl

use of org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb.NMContainerStatusPBImpl in project hadoop by apache.

the class TestProtocolRecords method testNMContainerStatus.

@Test
public void testNMContainerStatus() {
    ApplicationId appId = ApplicationId.newInstance(123456789, 1);
    ApplicationAttemptId attemptId = ApplicationAttemptId.newInstance(appId, 1);
    ContainerId containerId = ContainerId.newContainerId(attemptId, 1);
    Resource resource = Resource.newInstance(1000, 200);
    NMContainerStatus report = NMContainerStatus.newInstance(containerId, 0, ContainerState.COMPLETE, resource, "diagnostics", ContainerExitStatus.ABORTED, Priority.newInstance(10), 1234);
    NMContainerStatus reportProto = new NMContainerStatusPBImpl(((NMContainerStatusPBImpl) report).getProto());
    Assert.assertEquals("diagnostics", reportProto.getDiagnostics());
    Assert.assertEquals(resource, reportProto.getAllocatedResource());
    Assert.assertEquals(ContainerExitStatus.ABORTED, reportProto.getContainerExitStatus());
    Assert.assertEquals(ContainerState.COMPLETE, reportProto.getContainerState());
    Assert.assertEquals(containerId, reportProto.getContainerId());
    Assert.assertEquals(Priority.newInstance(10), reportProto.getPriority());
    Assert.assertEquals(1234, reportProto.getCreationTime());
}
Also used : ContainerId(org.apache.hadoop.yarn.api.records.ContainerId) Resource(org.apache.hadoop.yarn.api.records.Resource) ApplicationAttemptId(org.apache.hadoop.yarn.api.records.ApplicationAttemptId) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) NMContainerStatusPBImpl(org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb.NMContainerStatusPBImpl) Test(org.junit.Test)

Aggregations

ApplicationAttemptId (org.apache.hadoop.yarn.api.records.ApplicationAttemptId)1 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)1 ContainerId (org.apache.hadoop.yarn.api.records.ContainerId)1 Resource (org.apache.hadoop.yarn.api.records.Resource)1 NMContainerStatusPBImpl (org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb.NMContainerStatusPBImpl)1 Test (org.junit.Test)1