use of org.apache.hadoop.yarn.server.nodemanager.NodeStatusUpdater in project hadoop by apache.
the class TestDistributedScheduler method setup.
private RequestInterceptor setup(Configuration conf, DistributedScheduler distributedScheduler) {
NodeStatusUpdater nodeStatusUpdater = Mockito.mock(NodeStatusUpdater.class);
Mockito.when(nodeStatusUpdater.getRMIdentifier()).thenReturn(12345l);
NMContainerTokenSecretManager nmContainerTokenSecretManager = new NMContainerTokenSecretManager(conf);
MasterKey mKey = new MasterKey() {
@Override
public int getKeyId() {
return 1;
}
@Override
public void setKeyId(int keyId) {
}
@Override
public ByteBuffer getBytes() {
return ByteBuffer.allocate(8);
}
@Override
public void setBytes(ByteBuffer bytes) {
}
};
nmContainerTokenSecretManager.setMasterKey(mKey);
OpportunisticContainerAllocator containerAllocator = new OpportunisticContainerAllocator(nmContainerTokenSecretManager);
NMTokenSecretManagerInNM nmTokenSecretManagerInNM = new NMTokenSecretManagerInNM();
nmTokenSecretManagerInNM.setMasterKey(mKey);
distributedScheduler.initLocal(1234, ApplicationAttemptId.newInstance(ApplicationId.newInstance(1, 1), 1), containerAllocator, nmTokenSecretManagerInNM, "test");
RequestInterceptor finalReqIntcptr = Mockito.mock(RequestInterceptor.class);
distributedScheduler.setNextInterceptor(finalReqIntcptr);
return finalReqIntcptr;
}
use of org.apache.hadoop.yarn.server.nodemanager.NodeStatusUpdater in project hadoop by apache.
the class TestMiniYarnClusterNodeUtilization method testMockNodeStatusHeartbeat.
/**
* Trigger the NM to send a heartbeat using the simulated NodeStatus fixture.
* Verify both the RMNode and SchedulerNode have been updated with the new
* utilization.
*/
@Test(timeout = 60000)
public void testMockNodeStatusHeartbeat() throws InterruptedException, YarnException {
assertTrue("NMs fail to connect to the RM", cluster.waitForNodeManagersToConnect(10000));
NodeStatusUpdater updater = nm.getNodeStatusUpdater();
updater.sendOutofBandHeartBeat();
// Give the heartbeat time to propagate to the RM
verifySimulatedUtilization();
// Alter utilization
int responseId = 20;
nodeStatus = createNodeStatus(nm.getNMContext().getNodeId(), responseId, CONTAINER_PMEM_2, CONTAINER_VMEM_2, CONTAINER_CPU_2, NODE_PMEM_2, NODE_VMEM_2, NODE_CPU_2);
nm.setNodeStatus(nodeStatus);
updater.sendOutofBandHeartBeat();
verifySimulatedUtilization();
}
Aggregations