Search in sources :

Example 6 with LocalizerStatus

use of org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalizerStatus in project hadoop by apache.

the class TestPBRecordImpl method createLocalizerStatus.

static LocalizerStatus createLocalizerStatus() {
    LocalizerStatus ret = recordFactory.newRecordInstance(LocalizerStatus.class);
    assertTrue(ret instanceof LocalizerStatusPBImpl);
    ret.setLocalizerId("localizer0");
    ret.addResourceStatus(createLocalResourceStatus());
    return ret;
}
Also used : LocalizerStatus(org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalizerStatus)

Example 7 with LocalizerStatus

use of org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalizerStatus in project hadoop by apache.

the class TestPBRecordImpl method testLocalizerStatusSerDe.

@Test(timeout = 10000)
public void testLocalizerStatusSerDe() throws Exception {
    LocalizerStatus rsrcS = createLocalizerStatus();
    assertTrue(rsrcS instanceof LocalizerStatusPBImpl);
    LocalizerStatusPBImpl rsrcPb = (LocalizerStatusPBImpl) rsrcS;
    DataOutputBuffer out = new DataOutputBuffer();
    rsrcPb.getProto().writeDelimitedTo(out);
    DataInputBuffer in = new DataInputBuffer();
    in.reset(out.getData(), 0, out.getLength());
    LocalizerStatusProto rsrcPbD = LocalizerStatusProto.parseDelimitedFrom(in);
    assertNotNull(rsrcPbD);
    LocalizerStatus rsrcD = new LocalizerStatusPBImpl(rsrcPbD);
    assertEquals(rsrcS, rsrcD);
    assertEquals("localizer0", rsrcS.getLocalizerId());
    assertEquals("localizer0", rsrcD.getLocalizerId());
    assertEquals(createLocalResourceStatus(), rsrcS.getResourceStatus(0));
    assertEquals(createLocalResourceStatus(), rsrcD.getResourceStatus(0));
}
Also used : DataInputBuffer(org.apache.hadoop.io.DataInputBuffer) DataOutputBuffer(org.apache.hadoop.io.DataOutputBuffer) LocalizerStatus(org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalizerStatus) LocalizerStatusProto(org.apache.hadoop.yarn.proto.YarnServerNodemanagerServiceProtos.LocalizerStatusProto) Test(org.junit.Test)

Example 8 with LocalizerStatus

use of org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalizerStatus in project hadoop by apache.

the class TestContainerLocalizer method getMockLocalizerRecordFactory.

static RecordFactory getMockLocalizerRecordFactory() {
    RecordFactory mockRF = mock(RecordFactory.class);
    when(mockRF.newRecordInstance(same(LocalResourceStatus.class))).thenAnswer(new Answer<LocalResourceStatus>() {

        @Override
        public LocalResourceStatus answer(InvocationOnMock invoc) throws Throwable {
            return new MockLocalResourceStatus();
        }
    });
    when(mockRF.newRecordInstance(same(LocalizerStatus.class))).thenAnswer(new Answer<LocalizerStatus>() {

        @Override
        public LocalizerStatus answer(InvocationOnMock invoc) throws Throwable {
            return new MockLocalizerStatus();
        }
    });
    return mockRF;
}
Also used : RecordFactory(org.apache.hadoop.yarn.factories.RecordFactory) InvocationOnMock(org.mockito.invocation.InvocationOnMock) LocalizerStatus(org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalizerStatus) LocalResourceStatus(org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalResourceStatus)

Example 9 with LocalizerStatus

use of org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalizerStatus in project hadoop by apache.

the class TestPBLocalizerRPC method testLocalizerRPC.

@Test
public void testLocalizerRPC() throws Exception {
    InetSocketAddress locAddr = new InetSocketAddress("0.0.0.0", 8040);
    LocalizerService server = new LocalizerService(locAddr);
    try {
        server.start();
        Configuration conf = new Configuration();
        YarnRPC rpc = YarnRPC.create(conf);
        LocalizationProtocol client = (LocalizationProtocol) rpc.getProxy(LocalizationProtocol.class, locAddr, conf);
        LocalizerStatus status = recordFactory.newRecordInstance(LocalizerStatus.class);
        status.setLocalizerId("localizer0");
        LocalizerHeartbeatResponse response = client.heartbeat(status);
        assertEquals(dieHBResponse(), response);
    } finally {
        server.stop();
    }
    assertTrue(true);
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) LocalizationProtocol(org.apache.hadoop.yarn.server.nodemanager.api.LocalizationProtocol) InetSocketAddress(java.net.InetSocketAddress) LocalizerHeartbeatResponse(org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalizerHeartbeatResponse) YarnRPC(org.apache.hadoop.yarn.ipc.YarnRPC) LocalizerStatus(org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalizerStatus) Test(org.junit.Test)

Example 10 with LocalizerStatus

use of org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalizerStatus in project hadoop by apache.

the class TestResourceLocalizationService method createLocalizerStatusForFailedResource.

private LocalizerStatus createLocalizerStatusForFailedResource(String localizerId, LocalResourceRequest req) {
    LocalizerStatus status = createLocalizerStatus(localizerId);
    LocalResourceStatus resourceStatus = new LocalResourceStatusPBImpl();
    resourceStatus.setException(SerializedException.newInstance(new YarnException("test")));
    resourceStatus.setStatus(ResourceStatusType.FETCH_FAILURE);
    resourceStatus.setResource(req);
    status.addResourceStatus(resourceStatus);
    return status;
}
Also used : LocalResourceStatusPBImpl(org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.impl.pb.LocalResourceStatusPBImpl) LocalizerStatus(org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalizerStatus) LocalResourceStatus(org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalResourceStatus) YarnException(org.apache.hadoop.yarn.exceptions.YarnException)

Aggregations

LocalizerStatus (org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalizerStatus)12 Path (org.apache.hadoop.fs.Path)6 LocalResourceStatus (org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalResourceStatus)6 Test (org.junit.Test)6 LocalResource (org.apache.hadoop.yarn.api.records.LocalResource)5 LocalizerHeartbeatResponse (org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalizerHeartbeatResponse)5 ArrayList (java.util.ArrayList)4 Random (java.util.Random)4 Configuration (org.apache.hadoop.conf.Configuration)4 DataOutputBuffer (org.apache.hadoop.io.DataOutputBuffer)4 Collection (java.util.Collection)3 EnumSet (java.util.EnumSet)3 HashMap (java.util.HashMap)3 FSDataOutputStream (org.apache.hadoop.fs.FSDataOutputStream)3 ChecksumOpt (org.apache.hadoop.fs.Options.ChecksumOpt)3 FsPermission (org.apache.hadoop.fs.permission.FsPermission)3 Progressable (org.apache.hadoop.util.Progressable)3 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)3 LocalResourceVisibility (org.apache.hadoop.yarn.api.records.LocalResourceVisibility)3 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)3