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

x33g5p2x  于2022-02-05 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(75)

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

YarnScheduler.allocate介绍

[英]The main api between the ApplicationMaster and the Scheduler. The ApplicationMaster is updating his future resource requirements and may release containers he doens't need.
[中]ApplicationMaster和调度器之间的主api。应用程序管理员正在更新他未来的资源需求,可能会发布他不需要的容器。

代码示例

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

/**
 * {@link RMAppAttemptState#ALLOCATED}
 */
@SuppressWarnings("unchecked")
private void testAppAttemptAllocatedState(Container amContainer) {
 assertEquals(RMAppAttemptState.ALLOCATED, 
   applicationAttempt.getAppAttemptState());
 assertEquals(amContainer, applicationAttempt.getMasterContainer());
 // Check events
 verify(applicationMasterLauncher).handle(any(AMLauncherEvent.class));
 verify(scheduler, times(2)).allocate(any(ApplicationAttemptId.class),
   any(List.class), any(List.class), any(List.class), any(List.class), any(List.class),
   any(ContainerUpdates.class));
 verify(nmTokenManager).clearNodeSetForAttempt(
  applicationAttempt.getAppAttemptId());
}

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

/**
 * {@link RMAppAttemptState#ALLOCATED}
 */
@SuppressWarnings("unchecked")
private void testAppAttemptAllocatedState(Container amContainer) {
 assertEquals(RMAppAttemptState.ALLOCATED, 
   applicationAttempt.getAppAttemptState());
 assertEquals(amContainer, applicationAttempt.getMasterContainer());
 // Check events
 verify(applicationMasterLauncher).handle(any(AMLauncherEvent.class));
 verify(scheduler, times(2)).
   allocate(
     any(
       ApplicationAttemptId.class), any(List.class), any(List.class), 
       any(List.class), any(List.class));
 verify(nmTokenManager).clearNodeSetForAttempt(
  applicationAttempt.getAppAttemptId());
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager

appAttempt.scheduler.allocate(appAttempt.applicationAttemptId,
  Collections.singletonList(appAttempt.amReq),
  EMPTY_CONTAINER_RELEASE_LIST, null, null);

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

appAttempt.scheduler.allocate(appAttempt.applicationAttemptId,
  Collections.singletonList(appAttempt.amReq),
  EMPTY_CONTAINER_RELEASE_LIST, null, null);

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

public void testScheduleTransitionReplaceAMContainerRequestWithDefaults() {
 YarnScheduler mockScheduler = mock(YarnScheduler.class);
 when(mockScheduler.allocate(any(ApplicationAttemptId.class),
   any(List.class), any(List.class), any(List.class), any(List.class), any(List.class),
   any(ContainerUpdates.class)))

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

YarnScheduler mockScheduler = mock(YarnScheduler.class);
when(
  mockScheduler.allocate(any(ApplicationAttemptId.class),
    any(List.class), any(List.class), any(List.class), any(List.class)))
  .thenAnswer(new Answer<Allocation>() {

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

/**
 * {@link RMAppAttemptState#SCHEDULED}
 */
@SuppressWarnings("unchecked")
private void testAppAttemptScheduledState() {
 RMAppAttemptState expectedState;
 int expectedAllocateCount;
 if(unmanagedAM) {
  expectedState = RMAppAttemptState.LAUNCHED;
  expectedAllocateCount = 0;
 } else {
  expectedState = RMAppAttemptState.SCHEDULED;
  expectedAllocateCount = 1;
 }
 assertEquals(expectedState, applicationAttempt.getAppAttemptState());
 verify(scheduler, times(expectedAllocateCount)).allocate(
   any(ApplicationAttemptId.class), any(List.class), eq(null), any(List.class),
   any(List.class), any(List.class), any(ContainerUpdates.class));
 assertEquals(0,applicationAttempt.getJustFinishedContainers().size());
 assertNull(applicationAttempt.getMasterContainer());
 assertEquals(0.0, (double)applicationAttempt.getProgress(), 0.0001);
 assertEquals(0, application.getRanNodes().size());
 assertNull(applicationAttempt.getFinalApplicationStatus());
}

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

/**
 * {@link RMAppAttemptState#SCHEDULED}
 */
@SuppressWarnings("unchecked")
private void testAppAttemptScheduledState() {
 RMAppAttemptState expectedState;
 int expectedAllocateCount;
 if(unmanagedAM) {
  expectedState = RMAppAttemptState.LAUNCHED;
  expectedAllocateCount = 0;
 } else {
  expectedState = RMAppAttemptState.SCHEDULED;
  expectedAllocateCount = 1;
 }
 assertEquals(expectedState, 
   applicationAttempt.getAppAttemptState());
 verify(scheduler, times(expectedAllocateCount)).
 allocate(any(ApplicationAttemptId.class), 
   any(List.class), any(List.class), any(List.class), any(List.class));
 assertEquals(0,applicationAttempt.getJustFinishedContainers().size());
 assertNull(applicationAttempt.getMasterContainer());
 assertEquals(0.0, (double)applicationAttempt.getProgress(), 0.0001);
 assertEquals(0, application.getRanNodes().size());
 assertNull(applicationAttempt.getFinalApplicationStatus());
}

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

appAttempt.scheduler.allocate(appAttempt.applicationAttemptId,
 EMPTY_CONTAINER_REQUEST_LIST, EMPTY_CONTAINER_RELEASE_LIST, null,
 null);

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

appAttempt.scheduler.allocate(appAttempt.applicationAttemptId,
 EMPTY_CONTAINER_REQUEST_LIST, null, EMPTY_CONTAINER_RELEASE_LIST, null,
 null, new ContainerUpdates());

代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager

appAttempt.scheduler.allocate(appAttempt.applicationAttemptId,
 EMPTY_CONTAINER_REQUEST_LIST, EMPTY_CONTAINER_RELEASE_LIST, null,
 null);

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

when(allocation.getContainers()).
  thenReturn(Collections.singletonList(container));
when(scheduler.allocate(any(ApplicationAttemptId.class), any(List.class),
  any(List.class), any(List.class), any(List.class), any(List.class),
  any(ContainerUpdates.class))).

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

thenReturn(Collections.singletonList(container));
when(
  scheduler.allocate(
    any(ApplicationAttemptId.class), 
    any(List.class),

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

appAttempt.scheduler.allocate(
  appAttempt.applicationAttemptId,
  appAttempt.amReqs, null, EMPTY_CONTAINER_RELEASE_LIST,

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

when(allocation.getContainers()).
  thenReturn(Collections.singletonList(amContainer));
when(scheduler.allocate(any(ApplicationAttemptId.class), any(List.class),
  any(List.class), any(List.class), any(List.class), any(List.class),
  any(ContainerUpdates.class)))

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

when(allocation.getContainers()).
  thenReturn(Collections.singletonList(amContainer));
when(scheduler.allocate(any(ApplicationAttemptId.class), any(List.class),
  any(List.class), any(List.class), any(List.class))).thenReturn(allocation);
RMContainer rmContainer = mock(RMContainerImpl.class);

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

} else {
 try {
  allocation = getScheduler().allocate(appAttemptId, ask,
    request.getSchedulingRequests(), release,
    blacklistAdditions, blacklistRemovals, containerUpdateRequests);

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

this.rScheduler.allocate(appAttemptId, ask, release, 
  blacklistAdditions, blacklistRemovals);

代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager

this.rScheduler.allocate(appAttemptId, ask, release, 
  blacklistAdditions, blacklistRemovals);

相关文章