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;
}
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));
}
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;
}
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);
}
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;
}
Aggregations