Search in sources :

Example 1 with LocalResourceStatusProto

use of org.apache.hadoop.yarn.proto.YarnServerNodemanagerServiceProtos.LocalResourceStatusProto in project hadoop by apache.

the class LocalizerStatusPBImpl method initResources.

private void initResources() {
    if (this.resources != null) {
        return;
    }
    LocalizerStatusProtoOrBuilder p = viaProto ? proto : builder;
    List<LocalResourceStatusProto> list = p.getResourcesList();
    this.resources = new ArrayList<LocalResourceStatus>();
    for (LocalResourceStatusProto c : list) {
        this.resources.add(convertFromProtoFormat(c));
    }
}
Also used : LocalResourceStatusProto(org.apache.hadoop.yarn.proto.YarnServerNodemanagerServiceProtos.LocalResourceStatusProto) LocalizerStatusProtoOrBuilder(org.apache.hadoop.yarn.proto.YarnServerNodemanagerServiceProtos.LocalizerStatusProtoOrBuilder) LocalResourceStatus(org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalResourceStatus)

Example 2 with LocalResourceStatusProto

use of org.apache.hadoop.yarn.proto.YarnServerNodemanagerServiceProtos.LocalResourceStatusProto in project hadoop by apache.

the class TestPBRecordImpl method testLocalResourceStatusSerDe.

@Test(timeout = 10000)
public void testLocalResourceStatusSerDe() throws Exception {
    LocalResourceStatus rsrcS = createLocalResourceStatus();
    assertTrue(rsrcS instanceof LocalResourceStatusPBImpl);
    LocalResourceStatusPBImpl rsrcPb = (LocalResourceStatusPBImpl) rsrcS;
    DataOutputBuffer out = new DataOutputBuffer();
    rsrcPb.getProto().writeDelimitedTo(out);
    DataInputBuffer in = new DataInputBuffer();
    in.reset(out.getData(), 0, out.getLength());
    LocalResourceStatusProto rsrcPbD = LocalResourceStatusProto.parseDelimitedFrom(in);
    assertNotNull(rsrcPbD);
    LocalResourceStatus rsrcD = new LocalResourceStatusPBImpl(rsrcPbD);
    assertEquals(rsrcS, rsrcD);
    assertEquals(createResource(), rsrcS.getResource());
    assertEquals(createResource(), rsrcD.getResource());
}
Also used : LocalResourceStatusProto(org.apache.hadoop.yarn.proto.YarnServerNodemanagerServiceProtos.LocalResourceStatusProto) DataInputBuffer(org.apache.hadoop.io.DataInputBuffer) DataOutputBuffer(org.apache.hadoop.io.DataOutputBuffer) LocalResourceStatus(org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalResourceStatus) Test(org.junit.Test)

Aggregations

LocalResourceStatusProto (org.apache.hadoop.yarn.proto.YarnServerNodemanagerServiceProtos.LocalResourceStatusProto)2 LocalResourceStatus (org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalResourceStatus)2 DataInputBuffer (org.apache.hadoop.io.DataInputBuffer)1 DataOutputBuffer (org.apache.hadoop.io.DataOutputBuffer)1 LocalizerStatusProtoOrBuilder (org.apache.hadoop.yarn.proto.YarnServerNodemanagerServiceProtos.LocalizerStatusProtoOrBuilder)1 Test (org.junit.Test)1