use of org.apache.hadoop.yarn.server.api.ResourceTracker in project hadoop by apache.
the class TestResourceTrackerPBClientImpl method start.
@BeforeClass
public static void start() {
InetSocketAddress address = new InetSocketAddress(0);
Configuration configuration = new Configuration();
ResourceTracker instance = new ResourceTrackerTestImpl();
server = RpcServerFactoryPBImpl.get().getServer(ResourceTracker.class, instance, address, configuration, null, 1);
server.start();
client = (ResourceTracker) RpcClientFactoryPBImpl.get().getClient(ResourceTracker.class, 1, NetUtils.getConnectAddress(server), configuration);
}
use of org.apache.hadoop.yarn.server.api.ResourceTracker in project hadoop by apache.
the class TestYSCRPCFactories method testPbServerFactory.
private void testPbServerFactory() {
InetSocketAddress addr = new InetSocketAddress(0);
Configuration conf = new Configuration();
ResourceTracker instance = new ResourceTrackerTestImpl();
Server server = null;
try {
server = RpcServerFactoryPBImpl.get().getServer(ResourceTracker.class, instance, addr, conf, null, 1);
server.start();
} catch (YarnRuntimeException e) {
e.printStackTrace();
Assert.fail("Failed to create server");
} finally {
server.stop();
}
}
use of org.apache.hadoop.yarn.server.api.ResourceTracker in project hadoop by apache.
the class TestNodeStatusUpdaterForLabels method testInvalidNodeLabelsFromProvider.
@Test(timeout = 20000)
public void testInvalidNodeLabelsFromProvider() throws InterruptedException, IOException {
final ResourceTrackerForLabels resourceTracker = new ResourceTrackerForLabels();
nm = new NodeManager() {
@Override
protected NodeLabelsProvider createNodeLabelsProvider(Configuration conf) throws IOException {
return dummyLabelsProviderRef;
}
@Override
protected NodeStatusUpdater createNodeStatusUpdater(Context context, Dispatcher dispatcher, NodeHealthCheckerService healthChecker, NodeLabelsProvider labelsProvider) {
return new NodeStatusUpdaterImpl(context, dispatcher, healthChecker, metrics, labelsProvider) {
@Override
protected ResourceTracker getRMClient() {
return resourceTracker;
}
@Override
protected void stopRMProxy() {
return;
}
};
}
};
dummyLabelsProviderRef.setNodeLabels(toNodeLabelSet("P"));
YarnConfiguration conf = createNMConfigForDistributeNodeLabels();
conf.set(YarnConfiguration.NM_LOCALIZER_ADDRESS, "0.0.0.0:" + ServerSocketUtil.getPort(8040, 10));
nm.init(conf);
resourceTracker.resetNMHeartbeatReceiveFlag();
nm.start();
// wait till the first heartbeat
resourceTracker.waitTillHeartbeat();
resourceTracker.resetNMHeartbeatReceiveFlag();
// heartbeat with invalid labels
dummyLabelsProviderRef.setNodeLabels(toNodeLabelSet("_.P"));
sendOutofBandHeartBeat();
resourceTracker.waitTillHeartbeat();
assertNull("On Invalid Labels we need to retain earlier labels, HB " + "needs to send null", resourceTracker.labels);
resourceTracker.resetNMHeartbeatReceiveFlag();
// on next heartbeat same invalid labels will be given by the provider, but
// again label validation check and reset RM with empty labels set should
// not happen
sendOutofBandHeartBeat();
resourceTracker.waitTillHeartbeat();
assertNull("NodeStatusUpdater need not send repeatedly empty labels on " + "invalid labels from provider ", resourceTracker.labels);
resourceTracker.resetNMHeartbeatReceiveFlag();
}
use of org.apache.hadoop.yarn.server.api.ResourceTracker in project hadoop by apache.
the class TestMiniYarnClusterNodeUtilization method testUpdateNodeUtilization.
/**
* Simulates a NM heartbeat using the simulated NodeStatus fixture. Verify
* both the RMNode and SchedulerNode have been updated with the new
* utilization.
*/
@Test(timeout = 60000)
public void testUpdateNodeUtilization() throws InterruptedException, IOException, YarnException {
assertTrue("NMs fail to connect to the RM", cluster.waitForNodeManagersToConnect(10000));
// Simulate heartbeat using NodeStatus fixture
NodeHeartbeatRequest request = NodeHeartbeatRequest.newInstance(nodeStatus, null, null, null);
ResourceTracker tracker = ServerRMProxy.createRMProxy(conf, ResourceTracker.class);
tracker.nodeHeartbeat(request);
// Give the heartbeat time to propagate to the RM
verifySimulatedUtilization();
// Alter utilization
int responseId = 10;
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);
tracker.nodeHeartbeat(request);
// Give the heartbeat time to propagate to the RM
verifySimulatedUtilization();
}
use of org.apache.hadoop.yarn.server.api.ResourceTracker in project hadoop by apache.
the class TestYSCRPCFactories method testPbClientFactory.
private void testPbClientFactory() {
InetSocketAddress addr = new InetSocketAddress(0);
System.err.println(addr.getHostName() + addr.getPort());
Configuration conf = new Configuration();
ResourceTracker instance = new ResourceTrackerTestImpl();
Server server = null;
try {
server = RpcServerFactoryPBImpl.get().getServer(ResourceTracker.class, instance, addr, conf, null, 1);
server.start();
System.err.println(server.getListenerAddress());
System.err.println(NetUtils.getConnectAddress(server));
ResourceTracker client = null;
try {
client = (ResourceTracker) RpcClientFactoryPBImpl.get().getClient(ResourceTracker.class, 1, NetUtils.getConnectAddress(server), conf);
} catch (YarnRuntimeException e) {
e.printStackTrace();
Assert.fail("Failed to create client");
}
} catch (YarnRuntimeException e) {
e.printStackTrace();
Assert.fail("Failed to create server");
} finally {
server.stop();
}
}
Aggregations