gpt4 book ai didi

org.apache.hadoop.yarn.server.resourcemanager.scheduler.YarnScheduler.handle()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 01:40:49 29 4
gpt4 key购买 nike

本文整理了Java中org.apache.hadoop.yarn.server.resourcemanager.scheduler.YarnScheduler.handle()方法的一些代码示例,展示了YarnScheduler.handle()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YarnScheduler.handle()方法的具体详情如下:
包路径:org.apache.hadoop.yarn.server.resourcemanager.scheduler.YarnScheduler
类名称:YarnScheduler
方法名:handle

YarnScheduler.handle介绍

暂无

代码示例

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

@Override
 public void handle(SchedulerEvent event) {
  scheduler.handle(event);
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

@Override
 public void handle(SchedulerEvent event) {
  scheduler.handle(event);
 }
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

@Override
 public void handle(SchedulerEvent event) {
  scheduler.handle(event);
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

@Override
 public void handle(SchedulerEvent event) {
  scheduler.handle(event);
 }
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

@Override
 public void handle(SchedulerEvent event) {
  scheduler.handle(event);
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

@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());
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

@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());
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

@Test (timeout = 5000)
public void testExpiredContainer() {
 // Start the node
 node.handle(new RMNodeStartedEvent(null, null, null));
 verify(scheduler).handle(any(NodeAddedSchedulerEvent.class));
 
 // Expire a container
 ContainerId completedContainerId = BuilderUtils.newContainerId(
   BuilderUtils.newApplicationAttemptId(
     BuilderUtils.newApplicationId(0, 0), 0), 0);
 node.handle(new RMNodeCleanContainerEvent(null, completedContainerId));
 Assert.assertEquals(1, node.getContainersToCleanUp().size());
 
 // Now verify that scheduler isn't notified of an expired container
 // by checking number of 'completedContainers' it got in the previous event
 RMNodeStatusEvent statusEvent = getMockRMNodeStatusEvent(null);
 ContainerStatus containerStatus = mock(ContainerStatus.class);
 doReturn(completedContainerId).when(containerStatus).getContainerId();
 doReturn(Collections.singletonList(containerStatus)).
   when(statusEvent).getContainers();
 node.handle(statusEvent);
 /* Expect the scheduler call handle function 2 times
  * 1. RMNode status from new to Running, handle the add_node event
  * 2. handle the node update event
  */
 verify(scheduler,times(2)).handle(any(NodeUpdateSchedulerEvent.class));     
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

@Test (timeout = 5000)
public void testExpiredContainer() {
 // Start the node
 node.handle(new RMNodeStartedEvent(null, null, null));
 verify(scheduler).handle(any(NodeAddedSchedulerEvent.class));
 
 // Expire a container
 ContainerId completedContainerId = BuilderUtils.newContainerId(
   BuilderUtils.newApplicationAttemptId(
     BuilderUtils.newApplicationId(0, 0), 0), 0);
 node.handle(new RMNodeCleanContainerEvent(null, completedContainerId));
 Assert.assertEquals(1, node.getContainersToCleanUp().size());
 
 // Now verify that scheduler isn't notified of an expired container
 // by checking number of 'completedContainers' it got in the previous event
 RMNodeStatusEvent statusEvent = getMockRMNodeStatusEvent();
 ContainerStatus containerStatus = mock(ContainerStatus.class);
 doReturn(completedContainerId).when(containerStatus).getContainerId();
 doReturn(Collections.singletonList(containerStatus)).
   when(statusEvent).getContainers();
 node.handle(statusEvent);
 /* Expect the scheduler call handle function 2 times
  * 1. RMNode status from new to Running, handle the add_node event
  * 2. handle the node update event
  */
 verify(scheduler,times(2)).handle(any(NodeUpdateSchedulerEvent.class));     
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

@Before
public void setUp() throws Exception {
 InlineDispatcher rmDispatcher = new InlineDispatcher();
 rmContext =
   new RMContextImpl(rmDispatcher, null, null, null,
    null, null, null, null, null);
 rmContext.setSystemMetricsPublisher(mock(SystemMetricsPublisher.class));
 rmContext.setRMApplicationHistoryWriter(mock(RMApplicationHistoryWriter.class));
 rmContext
   .setRMTimelineCollectorManager(mock(RMTimelineCollectorManager.class));
 scheduler = mock(YarnScheduler.class);
 doAnswer(
   new Answer<Void>() {
    @Override
    public Void answer(InvocationOnMock invocation) throws Throwable {
     final SchedulerEvent event = (SchedulerEvent)(invocation.getArguments()[0]);
     eventType = event.getType();
     if (eventType == SchedulerEventType.NODE_UPDATE) {
      //DO NOTHING
     }
     return null;
    }
   }
   ).when(scheduler).handle(any(SchedulerEvent.class));
 rmDispatcher.register(SchedulerEventType.class,
   new TestSchedulerEventDispatcher());
 appId = ApplicationId.newInstance(System.currentTimeMillis(), 1);
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

).when(scheduler).handle(any(SchedulerEvent.class));

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

.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));

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

).when(scheduler).handle(any(SchedulerEvent.class));

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

.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));

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

.getContainers();
verify(scheduler, times(1)).handle(any(NodeUpdateSchedulerEvent.class));
node.handle(statusEvent1);
verify(scheduler, times(1)).handle(any(NodeUpdateSchedulerEvent.class));
Assert.assertEquals(1, node.getQueueSize());
Assert.assertEquals(1, node.getCompletedContainers().size());

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

/**
 * {@link RMAppAttemptState#SUBMITTED}
 */
private void testAppAttemptSubmittedState() {
 assertEquals(RMAppAttemptState.SUBMITTED, 
   applicationAttempt.getAppAttemptState());
 assertEquals(0, applicationAttempt.getDiagnostics().length());
 assertEquals(0,applicationAttempt.getJustFinishedContainers().size());
 assertNull(applicationAttempt.getMasterContainer());
 assertEquals(0.0, (double)applicationAttempt.getProgress(), 0.0001);
 assertEquals(0, application.getRanNodes().size());
 assertNull(applicationAttempt.getFinalApplicationStatus());
 if (UserGroupInformation.isSecurityEnabled()) {
  verify(clientToAMTokenManager).createMasterKey(
    applicationAttempt.getAppAttemptId());
  // can't create ClientToken as at this time ClientTokenMasterKey has
  // not been registered in the SecretManager
  assertNull(applicationAttempt.createClientToken("some client"));
 }
 assertNull(applicationAttempt.createClientToken(null));
 // Check events
 verify(masterService).
   registerAppAttempt(applicationAttempt.getAppAttemptId());
 verify(scheduler).handle(any(AppAttemptAddedSchedulerEvent.class));
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

/**
 * {@link RMAppAttemptState#SUBMITTED}
 */
private void testAppAttemptSubmittedState() {
 assertEquals(RMAppAttemptState.SUBMITTED, 
   applicationAttempt.getAppAttemptState());
 assertEquals(0, applicationAttempt.getDiagnostics().length());
 assertEquals(0,applicationAttempt.getJustFinishedContainers().size());
 assertNull(applicationAttempt.getMasterContainer());
 assertEquals(0.0, (double)applicationAttempt.getProgress(), 0.0001);
 assertEquals(0, application.getRanNodes().size());
 assertNull(applicationAttempt.getFinalApplicationStatus());
 if (UserGroupInformation.isSecurityEnabled()) {
  verify(clientToAMTokenManager).createMasterKey(
    applicationAttempt.getAppAttemptId());
  // can't create ClientToken as at this time ClientTokenMasterKey has
  // not been registered in the SecretManager
  assertNull(applicationAttempt.createClientToken("some client"));
 }
 assertNull(applicationAttempt.createClientToken(null));
 // Check events
 verify(masterService).
   registerAppAttempt(applicationAttempt.getAppAttemptId());
 verify(scheduler).handle(any(AppAttemptAddedSchedulerEvent.class));
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

List<NMContainerStatus> containerReports = new ArrayList<>();
containerReports.add(containerReport);
scheduler.handle(new NodeAddedSchedulerEvent(node1, containerReports));
RMContainer rmContainer = scheduler.getRMContainer(containerId);

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

scheduler.handle(new NodeAddedSchedulerEvent(node1));
Assert.assertEquals(1, scheduler.getNumClusterNodes());
maxVCores = scheduler.getMaximumResourceCapability().getVirtualCores();
Assert.assertEquals(expectedMaxVCores[1], maxVCores);
scheduler.handle(new NodeRemovedSchedulerEvent(node1));
Assert.assertEquals(0, scheduler.getNumClusterNodes());
maxVCores = scheduler.getMaximumResourceCapability().getVirtualCores();
scheduler.handle(new NodeAddedSchedulerEvent(node2));
Assert.assertEquals(1, scheduler.getNumClusterNodes());
maxVCores = scheduler.getMaximumResourceCapability().getVirtualCores();
scheduler.handle(new NodeAddedSchedulerEvent(node3));
Assert.assertEquals(2, scheduler.getNumClusterNodes());
maxVCores = scheduler.getMaximumResourceCapability().getVirtualCores();
Assert.assertEquals(expectedMaxVCores[4], maxVCores);
scheduler.handle(new NodeRemovedSchedulerEvent(node3));
Assert.assertEquals(1, scheduler.getNumClusterNodes());
maxVCores = scheduler.getMaximumResourceCapability().getVirtualCores();
Assert.assertEquals(expectedMaxVCores[5], maxVCores);
scheduler.handle(new NodeRemovedSchedulerEvent(node2));
Assert.assertEquals(0, scheduler.getNumClusterNodes());

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

scheduler.handle(new NodeAddedSchedulerEvent(node1));
Assert.assertEquals(1, scheduler.getNumClusterNodes());
maxMemory = scheduler.getMaximumResourceCapability().getMemorySize();
Assert.assertEquals(expectedMaxMemory[1], maxMemory);
scheduler.handle(new NodeRemovedSchedulerEvent(node1));
Assert.assertEquals(0, scheduler.getNumClusterNodes());
maxMemory = scheduler.getMaximumResourceCapability().getMemorySize();
scheduler.handle(new NodeAddedSchedulerEvent(node2));
Assert.assertEquals(1, scheduler.getNumClusterNodes());
maxMemory = scheduler.getMaximumResourceCapability().getMemorySize();
scheduler.handle(new NodeAddedSchedulerEvent(node3));
Assert.assertEquals(2, scheduler.getNumClusterNodes());
maxMemory = scheduler.getMaximumResourceCapability().getMemorySize();
Assert.assertEquals(expectedMaxMemory[4], maxMemory);
scheduler.handle(new NodeRemovedSchedulerEvent(node3));
Assert.assertEquals(1, scheduler.getNumClusterNodes());
maxMemory = scheduler.getMaximumResourceCapability().getMemorySize();
Assert.assertEquals(expectedMaxMemory[5], maxMemory);
scheduler.handle(new NodeRemovedSchedulerEvent(node2));
Assert.assertEquals(0, scheduler.getNumClusterNodes());

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com