org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeEventType Java Examples

The following examples show how to use org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeEventType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestRMNodeTransitions.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Test
public void testUnhealthyRebooting() {
  RMNodeImpl node = getUnhealthyNode();
  ClusterMetrics cm = ClusterMetrics.getMetrics();
  int initialActive = cm.getNumActiveNMs();
  int initialLost = cm.getNumLostNMs();
  int initialUnhealthy = cm.getUnhealthyNMs();
  int initialDecommissioned = cm.getNumDecommisionedNMs();
  int initialRebooted = cm.getNumRebootedNMs();
  node.handle(new RMNodeEvent(node.getNodeID(),
      RMNodeEventType.REBOOTING));
  Assert.assertEquals("Active Nodes", initialActive, cm.getNumActiveNMs());
  Assert.assertEquals("Lost Nodes", initialLost, cm.getNumLostNMs());
  Assert.assertEquals("Unhealthy Nodes",
      initialUnhealthy - 1, cm.getUnhealthyNMs());
  Assert.assertEquals("Decommissioned Nodes",
      initialDecommissioned, cm.getNumDecommisionedNMs());
  Assert.assertEquals("Rebooted Nodes",
      initialRebooted + 1, cm.getNumRebootedNMs());
  Assert.assertEquals(NodeState.REBOOTED, node.getState());
}
 
Example #2
Source File: TestRMNodeTransitions.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Test
public void testRunningDecommission() {
  RMNodeImpl node = getRunningNode();
  ClusterMetrics cm = ClusterMetrics.getMetrics();
  int initialActive = cm.getNumActiveNMs();
  int initialLost = cm.getNumLostNMs();
  int initialUnhealthy = cm.getUnhealthyNMs();
  int initialDecommissioned = cm.getNumDecommisionedNMs();
  int initialRebooted = cm.getNumRebootedNMs();
  node.handle(new RMNodeEvent(node.getNodeID(),
      RMNodeEventType.DECOMMISSION));
  Assert.assertEquals("Active Nodes", initialActive - 1, cm.getNumActiveNMs());
  Assert.assertEquals("Lost Nodes", initialLost, cm.getNumLostNMs());
  Assert.assertEquals("Unhealthy Nodes",
      initialUnhealthy, cm.getUnhealthyNMs());
  Assert.assertEquals("Decommissioned Nodes",
      initialDecommissioned + 1, cm.getNumDecommisionedNMs());
  Assert.assertEquals("Rebooted Nodes",
      initialRebooted, cm.getNumRebootedNMs());
  Assert.assertEquals(NodeState.DECOMMISSIONED, node.getState());
}
 
Example #3
Source File: TestRMNodeTransitions.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Test
public void testUnhealthyExpire() {
  RMNodeImpl node = getUnhealthyNode();
  ClusterMetrics cm = ClusterMetrics.getMetrics();
  int initialActive = cm.getNumActiveNMs();
  int initialLost = cm.getNumLostNMs();
  int initialUnhealthy = cm.getUnhealthyNMs();
  int initialDecommissioned = cm.getNumDecommisionedNMs();
  int initialRebooted = cm.getNumRebootedNMs();
  node.handle(new RMNodeEvent(node.getNodeID(), RMNodeEventType.EXPIRE));
  Assert.assertEquals("Active Nodes", initialActive, cm.getNumActiveNMs());
  Assert.assertEquals("Lost Nodes", initialLost + 1, cm.getNumLostNMs());
  Assert.assertEquals("Unhealthy Nodes",
      initialUnhealthy - 1, cm.getUnhealthyNMs());
  Assert.assertEquals("Decommissioned Nodes",
      initialDecommissioned, cm.getNumDecommisionedNMs());
  Assert.assertEquals("Rebooted Nodes",
      initialRebooted, cm.getNumRebootedNMs());
  Assert.assertEquals(NodeState.LOST, node.getState());
}
 
Example #4
Source File: TestRMNodeTransitions.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Test
public void testRunningExpire() {
  RMNodeImpl node = getRunningNode();
  ClusterMetrics cm = ClusterMetrics.getMetrics();
  int initialActive = cm.getNumActiveNMs();
  int initialLost = cm.getNumLostNMs();
  int initialUnhealthy = cm.getUnhealthyNMs();
  int initialDecommissioned = cm.getNumDecommisionedNMs();
  int initialRebooted = cm.getNumRebootedNMs();
  node.handle(new RMNodeEvent(node.getNodeID(), RMNodeEventType.EXPIRE));
  Assert.assertEquals("Active Nodes", initialActive - 1, cm.getNumActiveNMs());
  Assert.assertEquals("Lost Nodes", initialLost + 1, cm.getNumLostNMs());
  Assert.assertEquals("Unhealthy Nodes",
      initialUnhealthy, cm.getUnhealthyNMs());
  Assert.assertEquals("Decommissioned Nodes",
      initialDecommissioned, cm.getNumDecommisionedNMs());
  Assert.assertEquals("Rebooted Nodes",
      initialRebooted, cm.getNumRebootedNMs());
  Assert.assertEquals(NodeState.LOST, node.getState());
}
 
Example #5
Source File: TestRMNodeTransitions.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Test
public void testUnhealthyDecommission() {
  RMNodeImpl node = getUnhealthyNode();
  ClusterMetrics cm = ClusterMetrics.getMetrics();
  int initialActive = cm.getNumActiveNMs();
  int initialLost = cm.getNumLostNMs();
  int initialUnhealthy = cm.getUnhealthyNMs();
  int initialDecommissioned = cm.getNumDecommisionedNMs();
  int initialRebooted = cm.getNumRebootedNMs();
  node.handle(new RMNodeEvent(node.getNodeID(),
      RMNodeEventType.DECOMMISSION));
  Assert.assertEquals("Active Nodes", initialActive, cm.getNumActiveNMs());
  Assert.assertEquals("Lost Nodes", initialLost, cm.getNumLostNMs());
  Assert.assertEquals("Unhealthy Nodes",
      initialUnhealthy - 1, cm.getUnhealthyNMs());
  Assert.assertEquals("Decommissioned Nodes",
      initialDecommissioned + 1, cm.getNumDecommisionedNMs());
  Assert.assertEquals("Rebooted Nodes",
      initialRebooted, cm.getNumRebootedNMs());
  Assert.assertEquals(NodeState.DECOMMISSIONED, node.getState());
}
 
Example #6
Source File: TestRMNodeTransitions.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Test
public void testRunningRebooting() {
  RMNodeImpl node = getRunningNode();
  ClusterMetrics cm = ClusterMetrics.getMetrics();
  int initialActive = cm.getNumActiveNMs();
  int initialLost = cm.getNumLostNMs();
  int initialUnhealthy = cm.getUnhealthyNMs();
  int initialDecommissioned = cm.getNumDecommisionedNMs();
  int initialRebooted = cm.getNumRebootedNMs();
  node.handle(new RMNodeEvent(node.getNodeID(),
      RMNodeEventType.REBOOTING));
  Assert.assertEquals("Active Nodes", initialActive - 1, cm.getNumActiveNMs());
  Assert.assertEquals("Lost Nodes", initialLost, cm.getNumLostNMs());
  Assert.assertEquals("Unhealthy Nodes",
      initialUnhealthy, cm.getUnhealthyNMs());
  Assert.assertEquals("Decommissioned Nodes",
      initialDecommissioned, cm.getNumDecommisionedNMs());
  Assert.assertEquals("Rebooted Nodes",
      initialRebooted + 1, cm.getNumRebootedNMs());
  Assert.assertEquals(NodeState.REBOOTED, node.getState());
}
 
Example #7
Source File: TestRMNodeTransitions.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Test
public void testUnhealthyRebooting() {
  RMNodeImpl node = getUnhealthyNode();
  ClusterMetrics cm = ClusterMetrics.getMetrics();
  int initialActive = cm.getNumActiveNMs();
  int initialLost = cm.getNumLostNMs();
  int initialUnhealthy = cm.getUnhealthyNMs();
  int initialDecommissioned = cm.getNumDecommisionedNMs();
  int initialRebooted = cm.getNumRebootedNMs();
  node.handle(new RMNodeEvent(node.getNodeID(),
      RMNodeEventType.REBOOTING));
  Assert.assertEquals("Active Nodes", initialActive, cm.getNumActiveNMs());
  Assert.assertEquals("Lost Nodes", initialLost, cm.getNumLostNMs());
  Assert.assertEquals("Unhealthy Nodes",
      initialUnhealthy - 1, cm.getUnhealthyNMs());
  Assert.assertEquals("Decommissioned Nodes",
      initialDecommissioned, cm.getNumDecommisionedNMs());
  Assert.assertEquals("Rebooted Nodes",
      initialRebooted + 1, cm.getNumRebootedNMs());
  Assert.assertEquals(NodeState.REBOOTED, node.getState());
}
 
Example #8
Source File: TestRMNodeTransitions.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Test
public void testRunningRebooting() {
  RMNodeImpl node = getRunningNode();
  ClusterMetrics cm = ClusterMetrics.getMetrics();
  int initialActive = cm.getNumActiveNMs();
  int initialLost = cm.getNumLostNMs();
  int initialUnhealthy = cm.getUnhealthyNMs();
  int initialDecommissioned = cm.getNumDecommisionedNMs();
  int initialRebooted = cm.getNumRebootedNMs();
  node.handle(new RMNodeEvent(node.getNodeID(),
      RMNodeEventType.REBOOTING));
  Assert.assertEquals("Active Nodes", initialActive - 1, cm.getNumActiveNMs());
  Assert.assertEquals("Lost Nodes", initialLost, cm.getNumLostNMs());
  Assert.assertEquals("Unhealthy Nodes",
      initialUnhealthy, cm.getUnhealthyNMs());
  Assert.assertEquals("Decommissioned Nodes",
      initialDecommissioned, cm.getNumDecommisionedNMs());
  Assert.assertEquals("Rebooted Nodes",
      initialRebooted + 1, cm.getNumRebootedNMs());
  Assert.assertEquals(NodeState.REBOOTED, node.getState());
}
 
Example #9
Source File: TestRMNodeTransitions.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Test
public void testUnhealthyDecommission() {
  RMNodeImpl node = getUnhealthyNode();
  ClusterMetrics cm = ClusterMetrics.getMetrics();
  int initialActive = cm.getNumActiveNMs();
  int initialLost = cm.getNumLostNMs();
  int initialUnhealthy = cm.getUnhealthyNMs();
  int initialDecommissioned = cm.getNumDecommisionedNMs();
  int initialRebooted = cm.getNumRebootedNMs();
  node.handle(new RMNodeEvent(node.getNodeID(),
      RMNodeEventType.DECOMMISSION));
  Assert.assertEquals("Active Nodes", initialActive, cm.getNumActiveNMs());
  Assert.assertEquals("Lost Nodes", initialLost, cm.getNumLostNMs());
  Assert.assertEquals("Unhealthy Nodes",
      initialUnhealthy - 1, cm.getUnhealthyNMs());
  Assert.assertEquals("Decommissioned Nodes",
      initialDecommissioned + 1, cm.getNumDecommisionedNMs());
  Assert.assertEquals("Rebooted Nodes",
      initialRebooted, cm.getNumRebootedNMs());
  Assert.assertEquals(NodeState.DECOMMISSIONED, node.getState());
}
 
Example #10
Source File: TestRMNodeTransitions.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Test
public void testRunningDecommission() {
  RMNodeImpl node = getRunningNode();
  ClusterMetrics cm = ClusterMetrics.getMetrics();
  int initialActive = cm.getNumActiveNMs();
  int initialLost = cm.getNumLostNMs();
  int initialUnhealthy = cm.getUnhealthyNMs();
  int initialDecommissioned = cm.getNumDecommisionedNMs();
  int initialRebooted = cm.getNumRebootedNMs();
  node.handle(new RMNodeEvent(node.getNodeID(),
      RMNodeEventType.DECOMMISSION));
  Assert.assertEquals("Active Nodes", initialActive - 1, cm.getNumActiveNMs());
  Assert.assertEquals("Lost Nodes", initialLost, cm.getNumLostNMs());
  Assert.assertEquals("Unhealthy Nodes",
      initialUnhealthy, cm.getUnhealthyNMs());
  Assert.assertEquals("Decommissioned Nodes",
      initialDecommissioned + 1, cm.getNumDecommisionedNMs());
  Assert.assertEquals("Rebooted Nodes",
      initialRebooted, cm.getNumRebootedNMs());
  Assert.assertEquals(NodeState.DECOMMISSIONED, node.getState());
}
 
Example #11
Source File: TestRMNodeTransitions.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Test
public void testUnhealthyExpire() {
  RMNodeImpl node = getUnhealthyNode();
  ClusterMetrics cm = ClusterMetrics.getMetrics();
  int initialActive = cm.getNumActiveNMs();
  int initialLost = cm.getNumLostNMs();
  int initialUnhealthy = cm.getUnhealthyNMs();
  int initialDecommissioned = cm.getNumDecommisionedNMs();
  int initialRebooted = cm.getNumRebootedNMs();
  node.handle(new RMNodeEvent(node.getNodeID(), RMNodeEventType.EXPIRE));
  Assert.assertEquals("Active Nodes", initialActive, cm.getNumActiveNMs());
  Assert.assertEquals("Lost Nodes", initialLost + 1, cm.getNumLostNMs());
  Assert.assertEquals("Unhealthy Nodes",
      initialUnhealthy - 1, cm.getUnhealthyNMs());
  Assert.assertEquals("Decommissioned Nodes",
      initialDecommissioned, cm.getNumDecommisionedNMs());
  Assert.assertEquals("Rebooted Nodes",
      initialRebooted, cm.getNumRebootedNMs());
  Assert.assertEquals(NodeState.LOST, node.getState());
}
 
Example #12
Source File: TestRMNodeTransitions.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Test
public void testRunningExpire() {
  RMNodeImpl node = getRunningNode();
  ClusterMetrics cm = ClusterMetrics.getMetrics();
  int initialActive = cm.getNumActiveNMs();
  int initialLost = cm.getNumLostNMs();
  int initialUnhealthy = cm.getUnhealthyNMs();
  int initialDecommissioned = cm.getNumDecommisionedNMs();
  int initialRebooted = cm.getNumRebootedNMs();
  node.handle(new RMNodeEvent(node.getNodeID(), RMNodeEventType.EXPIRE));
  Assert.assertEquals("Active Nodes", initialActive - 1, cm.getNumActiveNMs());
  Assert.assertEquals("Lost Nodes", initialLost + 1, cm.getNumLostNMs());
  Assert.assertEquals("Unhealthy Nodes",
      initialUnhealthy, cm.getUnhealthyNMs());
  Assert.assertEquals("Decommissioned Nodes",
      initialDecommissioned, cm.getNumDecommisionedNMs());
  Assert.assertEquals("Rebooted Nodes",
      initialRebooted, cm.getNumRebootedNMs());
  Assert.assertEquals(NodeState.LOST, node.getState());
}
 
Example #13
Source File: TestRMNMRPCResponseId.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
  Configuration conf = new Configuration();
  // Dispatcher that processes events inline
  Dispatcher dispatcher = new InlineDispatcher();
  dispatcher.register(SchedulerEventType.class, new EventHandler<Event>() {
    @Override
    public void handle(Event event) {
      ; // ignore
    }
  });
  RMContext context =
      new RMContextImpl(dispatcher, null, null, null, null,
        null, new RMContainerTokenSecretManager(conf),
        new NMTokenSecretManagerInRM(conf), null, null);
  dispatcher.register(RMNodeEventType.class,
      new ResourceManager.NodeEventDispatcher(context));
  NodesListManager nodesListManager = new NodesListManager(context);
  nodesListManager.init(conf);
  
  context.getContainerTokenSecretManager().rollMasterKey();
  context.getNMTokenSecretManager().rollMasterKey();
  resourceTrackerService = new ResourceTrackerService(context,
      nodesListManager, new NMLivelinessMonitor(dispatcher),
      context.getContainerTokenSecretManager(),
      context.getNMTokenSecretManager());
  resourceTrackerService.init(conf);
}
 
Example #14
Source File: NMHeartBeatHandlerTest.java    From incubator-myriad with Apache License 2.0 5 votes vote down vote up
@Test
public void testNonZeroNodeStartedEvent() throws Exception {
  NMHeartBeatHandler.CallBackFilter filter = handler.getCallBackFilter();
  filter.allowCallBacksForNode(nodeTwo.getNodeID());
  RMNodeEvent event = new RMNodeEvent(nodeTwo.getNodeID(), RMNodeEventType.STARTED);
  handler.beforeRMNodeEventHandled(event, context);
  /*
   * Confirm that, since fine-grained scaling does not work for non-zero nodes, the
   * capacity is set to zero for cores and memory
   */
  assertEquals(0, nodeTwo.getTotalCapability().getVirtualCores());
  assertEquals(0, nodeTwo.getTotalCapability().getMemory());
}
 
Example #15
Source File: TestRMNodeTransitions.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Test
public void testUnhealthyExpireForSchedulerRemove() {
  RMNodeImpl node = getUnhealthyNode();
  verify(scheduler,times(2)).handle(any(NodeRemovedSchedulerEvent.class));
  node.handle(new RMNodeEvent(node.getNodeID(), RMNodeEventType.EXPIRE));
  verify(scheduler,times(2)).handle(any(NodeRemovedSchedulerEvent.class));
  Assert.assertEquals(NodeState.LOST, node.getState());
}
 
Example #16
Source File: NMHeartBeatHandlerTest.java    From incubator-myriad with Apache License 2.0 5 votes vote down vote up
@Test
public void testZeroNodeStartedEvent() throws Exception {
  NMHeartBeatHandler.CallBackFilter filter = handler.getCallBackFilter();
  filter.allowCallBacksForNode(nodeOne.getNodeID());
  RMNodeEvent event = new RMNodeEvent(nodeOne.getNodeID(), RMNodeEventType.STARTED);
  handler.beforeRMNodeEventHandled(event, context);
  assertEquals(0, nodeOne.getTotalCapability().getVirtualCores());
  assertEquals(0, nodeOne.getTotalCapability().getMemory());
}
 
Example #17
Source File: MyriadFifoScheduler.java    From incubator-myriad with Apache License 2.0 5 votes vote down vote up
/**
 * Register an event handler that receives {@link RMNodeEvent} events.
 * This event handler is registered ahead of RM's own event handler for RMNodeEvents.
 * For e.g. myriad can inspect a node's HB (RMNodeStatusEvent) before the HB is handled by
 * RM and the scheduler.
 *
 * @param rmContext
 */
@Override
public synchronized void setRMContext(RMContext rmContext) {
  this.rmContext = rmContext;
  this.yarnSchedulerInterceptor = new CompositeInterceptor();
  rmNodeEventHandler = new RMNodeEventHandler(yarnSchedulerInterceptor, rmContext);
  rmContext.getDispatcher().register(RMNodeEventType.class, rmNodeEventHandler);
  super.setRMContext(rmContext);
}
 
Example #18
Source File: TestRMNodeTransitions.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Test (timeout = 5000)
public void testStatusChange(){
  //Start the node
  node.handle(new RMNodeStartedEvent(null, null, null));
  //Add info to the queue first
  node.setNextHeartBeat(false);

  ContainerId completedContainerId1 = BuilderUtils.newContainerId(
      BuilderUtils.newApplicationAttemptId(
          BuilderUtils.newApplicationId(0, 0), 0), 0);
  ContainerId completedContainerId2 = BuilderUtils.newContainerId(
      BuilderUtils.newApplicationAttemptId(
          BuilderUtils.newApplicationId(1, 1), 1), 1);
      
  RMNodeStatusEvent statusEvent1 = getMockRMNodeStatusEvent();
  RMNodeStatusEvent statusEvent2 = getMockRMNodeStatusEvent();

  ContainerStatus containerStatus1 = mock(ContainerStatus.class);
  ContainerStatus containerStatus2 = mock(ContainerStatus.class);

  doReturn(completedContainerId1).when(containerStatus1).getContainerId();
  doReturn(Collections.singletonList(containerStatus1))
      .when(statusEvent1).getContainers();
   
  doReturn(completedContainerId2).when(containerStatus2).getContainerId();
  doReturn(Collections.singletonList(containerStatus2))
      .when(statusEvent2).getContainers();

  verify(scheduler,times(1)).handle(any(NodeUpdateSchedulerEvent.class)); 
  node.handle(statusEvent1);
  node.handle(statusEvent2);
  verify(scheduler,times(1)).handle(any(NodeUpdateSchedulerEvent.class));
  Assert.assertEquals(2, node.getQueueSize());
  node.handle(new RMNodeEvent(node.getNodeID(), RMNodeEventType.EXPIRE));
  Assert.assertEquals(0, node.getQueueSize());
}
 
Example #19
Source File: TestRMNodeTransitions.java    From big-c with Apache License 2.0 5 votes vote down vote up
private RMNodeStatusEvent getMockRMNodeStatusEvent() {
  NodeHeartbeatResponse response = mock(NodeHeartbeatResponse.class);

  NodeHealthStatus healthStatus = mock(NodeHealthStatus.class);
  Boolean yes = new Boolean(true);
  doReturn(yes).when(healthStatus).getIsNodeHealthy();
  
  RMNodeStatusEvent event = mock(RMNodeStatusEvent.class);
  doReturn(healthStatus).when(event).getNodeHealthStatus();
  doReturn(response).when(event).getLatestResponse();
  doReturn(RMNodeEventType.STATUS_UPDATE).when(event).getType();
  return event;
}
 
Example #20
Source File: TestNMReconnect.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Test
public void testReconnect() throws Exception {
  String hostname1 = "localhost1";
  Resource capability = BuilderUtils.newResource(1024, 1);

  RegisterNodeManagerRequest request1 = recordFactory
      .newRecordInstance(RegisterNodeManagerRequest.class);
  NodeId nodeId1 = NodeId.newInstance(hostname1, 0);
  request1.setNodeId(nodeId1);
  request1.setHttpPort(0);
  request1.setResource(capability);
  resourceTrackerService.registerNodeManager(request1);

  Assert.assertEquals(RMNodeEventType.STARTED, rmNodeEvents.get(0).getType());

  rmNodeEvents.clear();
  resourceTrackerService.registerNodeManager(request1);
  Assert.assertEquals(RMNodeEventType.RECONNECTED,
      rmNodeEvents.get(0).getType());

  rmNodeEvents.clear();
  resourceTrackerService.registerNodeManager(request1);
  capability = BuilderUtils.newResource(1024, 2);
  request1.setResource(capability);
  Assert.assertEquals(RMNodeEventType.RECONNECTED,
      rmNodeEvents.get(0).getType());
}
 
Example #21
Source File: TestNMReconnect.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
  Configuration conf = new Configuration();
  // Dispatcher that processes events inline
  Dispatcher dispatcher = new InlineDispatcher();

  dispatcher.register(RMNodeEventType.class,
      new TestRMNodeEventDispatcher());

  RMContext context = new RMContextImpl(dispatcher, null,
      null, null, null, null, null, null, null, null);
  dispatcher.register(SchedulerEventType.class,
      new InlineDispatcher.EmptyEventHandler());
  dispatcher.register(RMNodeEventType.class,
      new NodeEventDispatcher(context));
  NMLivelinessMonitor nmLivelinessMonitor = new NMLivelinessMonitor(
      dispatcher);
  nmLivelinessMonitor.init(conf);
  nmLivelinessMonitor.start();
  NodesListManager nodesListManager = new NodesListManager(context);
  nodesListManager.init(conf);
  RMContainerTokenSecretManager containerTokenSecretManager =
      new RMContainerTokenSecretManager(conf);
  containerTokenSecretManager.start();
  NMTokenSecretManagerInRM nmTokenSecretManager =
      new NMTokenSecretManagerInRM(conf);
  nmTokenSecretManager.start();
  resourceTrackerService = new ResourceTrackerService(context,
      nodesListManager, nmLivelinessMonitor, containerTokenSecretManager,
      nmTokenSecretManager);
  
  resourceTrackerService.init(conf);
  resourceTrackerService.start();
}
 
Example #22
Source File: TestNMExpiry.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
  Configuration conf = new Configuration();
  // Dispatcher that processes events inline
  Dispatcher dispatcher = new InlineDispatcher();
  RMContext context = new RMContextImpl(dispatcher, null,
      null, null, null, null, null, null, null, null);
  dispatcher.register(SchedulerEventType.class,
      new InlineDispatcher.EmptyEventHandler());
  dispatcher.register(RMNodeEventType.class,
      new NodeEventDispatcher(context));
  NMLivelinessMonitor nmLivelinessMonitor = new TestNmLivelinessMonitor(
      dispatcher);
  nmLivelinessMonitor.init(conf);
  nmLivelinessMonitor.start();
  NodesListManager nodesListManager = new NodesListManager(context);
  nodesListManager.init(conf);
  RMContainerTokenSecretManager containerTokenSecretManager =
      new RMContainerTokenSecretManager(conf);
  containerTokenSecretManager.start();
  NMTokenSecretManagerInRM nmTokenSecretManager =
      new NMTokenSecretManagerInRM(conf);
  nmTokenSecretManager.start();
  resourceTrackerService = new ResourceTrackerService(context,
      nodesListManager, nmLivelinessMonitor, containerTokenSecretManager,
      nmTokenSecretManager);
  
  resourceTrackerService.init(conf);
  resourceTrackerService.start();
}
 
Example #23
Source File: TestRMNMRPCResponseId.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
  Configuration conf = new Configuration();
  // Dispatcher that processes events inline
  Dispatcher dispatcher = new InlineDispatcher();
  dispatcher.register(SchedulerEventType.class, new EventHandler<Event>() {
    @Override
    public void handle(Event event) {
      ; // ignore
    }
  });
  RMContext context =
      new RMContextImpl(dispatcher, null, null, null, null,
        null, new RMContainerTokenSecretManager(conf),
        new NMTokenSecretManagerInRM(conf), null, null);
  dispatcher.register(RMNodeEventType.class,
      new ResourceManager.NodeEventDispatcher(context));
  NodesListManager nodesListManager = new NodesListManager(context);
  nodesListManager.init(conf);
  
  context.getContainerTokenSecretManager().rollMasterKey();
  context.getNMTokenSecretManager().rollMasterKey();
  resourceTrackerService = new ResourceTrackerService(context,
      nodesListManager, new NMLivelinessMonitor(dispatcher),
      context.getContainerTokenSecretManager(),
      context.getNMTokenSecretManager());
  resourceTrackerService.init(conf);
}
 
Example #24
Source File: MyriadCapacityScheduler.java    From incubator-myriad with Apache License 2.0 5 votes vote down vote up
/**
 * Register an event handler that receives {@link RMNodeEvent} events.
 * This event handler is registered ahead of RM's own event handler for RMNodeEvents.
 * For e.g. myriad can inspect a node's HB (RMNodeStatusEvent) before the HB is handled by
 * RM and the scheduler.
 *
 * @param rmContext
 */
@Override
public synchronized void setRMContext(RMContext rmContext) {
  this.rmContext = rmContext;
  this.yarnSchedulerInterceptor = new CompositeInterceptor();
  rmNodeEventHandler = new RMNodeEventHandler(yarnSchedulerInterceptor, rmContext);
  rmContext.getDispatcher().register(RMNodeEventType.class, rmNodeEventHandler);
  super.setRMContext(rmContext);
}
 
Example #25
Source File: TestNMExpiry.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
  Configuration conf = new Configuration();
  // Dispatcher that processes events inline
  Dispatcher dispatcher = new InlineDispatcher();
  RMContext context = new RMContextImpl(dispatcher, null,
      null, null, null, null, null, null, null, null);
  dispatcher.register(SchedulerEventType.class,
      new InlineDispatcher.EmptyEventHandler());
  dispatcher.register(RMNodeEventType.class,
      new NodeEventDispatcher(context));
  NMLivelinessMonitor nmLivelinessMonitor = new TestNmLivelinessMonitor(
      dispatcher);
  nmLivelinessMonitor.init(conf);
  nmLivelinessMonitor.start();
  NodesListManager nodesListManager = new NodesListManager(context);
  nodesListManager.init(conf);
  RMContainerTokenSecretManager containerTokenSecretManager =
      new RMContainerTokenSecretManager(conf);
  containerTokenSecretManager.start();
  NMTokenSecretManagerInRM nmTokenSecretManager =
      new NMTokenSecretManagerInRM(conf);
  nmTokenSecretManager.start();
  resourceTrackerService = new ResourceTrackerService(context,
      nodesListManager, nmLivelinessMonitor, containerTokenSecretManager,
      nmTokenSecretManager);
  
  resourceTrackerService.init(conf);
  resourceTrackerService.start();
}
 
Example #26
Source File: TestRMNodeTransitions.java    From big-c with Apache License 2.0 5 votes vote down vote up
private RMNodeImpl getRebootedNode() {
  NodeId nodeId = BuilderUtils.newNodeId("localhost", 0);
  Resource capability = Resource.newInstance(4096, 4);
  RMNodeImpl node = new RMNodeImpl(nodeId, rmContext,null, 0, 0,
      null, capability, null);
  node.handle(new RMNodeStartedEvent(node.getNodeID(), null, null));
  Assert.assertEquals(NodeState.RUNNING, node.getState());
  node.handle(new RMNodeEvent(node.getNodeID(), RMNodeEventType.REBOOTING));
  Assert.assertEquals(NodeState.REBOOTED, node.getState());
  return node;
}
 
Example #27
Source File: MyriadFairScheduler.java    From incubator-myriad with Apache License 2.0 5 votes vote down vote up
/**
 * Register an event handler that receives {@link RMNodeEvent} events.
 * This event handler is registered ahead of RM's own event handler for RMNodeEvents.
 * For e.g. myriad can inspect a node's HB (RMNodeStatusEvent) before the HB is handled by
 * RM and the scheduler.
 *
 * @param rmContext
 */
@Override
public synchronized void setRMContext(RMContext rmContext) {
  this.rmContext = rmContext;
  this.yarnSchedulerInterceptor = new CompositeInterceptor();
  rmNodeEventHandler = new RMNodeEventHandler(yarnSchedulerInterceptor, rmContext);
  rmContext.getDispatcher().register(RMNodeEventType.class, rmNodeEventHandler);
  super.setRMContext(rmContext);
}
 
Example #28
Source File: TestRMNodeTransitions.java    From hadoop with Apache License 2.0 5 votes vote down vote up
private RMNodeImpl getRebootedNode() {
  NodeId nodeId = BuilderUtils.newNodeId("localhost", 0);
  Resource capability = Resource.newInstance(4096, 4, 4);
  RMNodeImpl node = new RMNodeImpl(nodeId, rmContext,null, 0, 0,
      null, capability, null);
  node.handle(new RMNodeStartedEvent(node.getNodeID(), null, null));
  Assert.assertEquals(NodeState.RUNNING, node.getState());
  node.handle(new RMNodeEvent(node.getNodeID(), RMNodeEventType.REBOOTING));
  Assert.assertEquals(NodeState.REBOOTED, node.getState());
  return node;
}
 
Example #29
Source File: TestNMReconnect.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
  Configuration conf = new Configuration();
  // Dispatcher that processes events inline
  Dispatcher dispatcher = new InlineDispatcher();

  dispatcher.register(RMNodeEventType.class,
      new TestRMNodeEventDispatcher());

  RMContext context = new RMContextImpl(dispatcher, null,
      null, null, null, null, null, null, null, null);
  dispatcher.register(SchedulerEventType.class,
      new InlineDispatcher.EmptyEventHandler());
  dispatcher.register(RMNodeEventType.class,
      new NodeEventDispatcher(context));
  NMLivelinessMonitor nmLivelinessMonitor = new NMLivelinessMonitor(
      dispatcher);
  nmLivelinessMonitor.init(conf);
  nmLivelinessMonitor.start();
  NodesListManager nodesListManager = new NodesListManager(context);
  nodesListManager.init(conf);
  RMContainerTokenSecretManager containerTokenSecretManager =
      new RMContainerTokenSecretManager(conf);
  containerTokenSecretManager.start();
  NMTokenSecretManagerInRM nmTokenSecretManager =
      new NMTokenSecretManagerInRM(conf);
  nmTokenSecretManager.start();
  resourceTrackerService = new ResourceTrackerService(context,
      nodesListManager, nmLivelinessMonitor, containerTokenSecretManager,
      nmTokenSecretManager);
  
  resourceTrackerService.init(conf);
  resourceTrackerService.start();
}
 
Example #30
Source File: TestNMReconnect.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Test
public void testReconnect() throws Exception {
  String hostname1 = "localhost1";
  Resource capability = BuilderUtils.newResource(1024, 1, 1);

  RegisterNodeManagerRequest request1 = recordFactory
      .newRecordInstance(RegisterNodeManagerRequest.class);
  NodeId nodeId1 = NodeId.newInstance(hostname1, 0);
  request1.setNodeId(nodeId1);
  request1.setHttpPort(0);
  request1.setResource(capability);
  resourceTrackerService.registerNodeManager(request1);

  Assert.assertEquals(RMNodeEventType.STARTED, rmNodeEvents.get(0).getType());

  rmNodeEvents.clear();
  resourceTrackerService.registerNodeManager(request1);
  Assert.assertEquals(RMNodeEventType.RECONNECTED,
      rmNodeEvents.get(0).getType());

  rmNodeEvents.clear();
  resourceTrackerService.registerNodeManager(request1);
  capability = BuilderUtils.newResource(1024, 2, 2);
  request1.setResource(capability);
  Assert.assertEquals(RMNodeEventType.RECONNECTED,
      rmNodeEvents.get(0).getType());
}