• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java AbstractYarnScheduler类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler的典型用法代码示例。如果您正苦于以下问题:Java AbstractYarnScheduler类的具体用法?Java AbstractYarnScheduler怎么用?Java AbstractYarnScheduler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AbstractYarnScheduler类属于org.apache.hadoop.yarn.server.resourcemanager.scheduler包,在下文中一共展示了AbstractYarnScheduler类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testAddAndRemoveAppFromCapacityScheduler

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler; //导入依赖的package包/类
@Test
public void testAddAndRemoveAppFromCapacityScheduler() throws Exception {
  CapacitySchedulerConfiguration conf = new CapacitySchedulerConfiguration();
  setupQueueConfiguration(conf);
  conf.setClass(YarnConfiguration.RM_SCHEDULER, CapacityScheduler.class,
    ResourceScheduler.class);
  MockRM rm = new MockRM(conf);
  @SuppressWarnings("unchecked")
  AbstractYarnScheduler<SchedulerApplicationAttempt, SchedulerNode> cs =
      (AbstractYarnScheduler<SchedulerApplicationAttempt, SchedulerNode>) rm
        .getResourceScheduler();

  SchedulerApplication<SchedulerApplicationAttempt> app =
      TestSchedulerUtils.verifyAppAddedAndRemovedFromScheduler(
        cs.getSchedulerApplications(), cs, "a1");
  Assert.assertEquals("a1", app.getQueue().getQueueName());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:TestCapacityScheduler.java


示例2: waitForNumContainersToRecover

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler; //导入依赖的package包/类
public static void waitForNumContainersToRecover(int num, MockRM rm,
    ApplicationAttemptId attemptId) throws Exception {
  AbstractYarnScheduler scheduler =
      (AbstractYarnScheduler) rm.getResourceScheduler();
  SchedulerApplicationAttempt attempt =
      scheduler.getApplicationAttempt(attemptId);
  while (attempt == null) {
    System.out.println("Wait for scheduler attempt " + attemptId
        + " to be created");
    Thread.sleep(200);
    attempt = scheduler.getApplicationAttempt(attemptId);
  }
  while (attempt.getLiveContainers().size() < num) {
    System.out.println("Wait for " + num
        + " containers to recover. currently: "
        + attempt.getLiveContainers().size());
    Thread.sleep(200);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:TestWorkPreservingRMRestart.java


示例3: waitForSchedulerAppAttemptAdded

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
private static void waitForSchedulerAppAttemptAdded(
    ApplicationAttemptId attemptId, MockRM rm) throws InterruptedException {
  int tick = 0;
  // Wait for at most 5 sec
  while (null == ((AbstractYarnScheduler) rm.getResourceScheduler())
      .getApplicationAttempt(attemptId) && tick < 50) {
    Thread.sleep(100);
    if (tick % 10 == 0) {
      System.out.println("waiting for SchedulerApplicationAttempt="
          + attemptId + " added.");
    }
    tick++;
  }
  Assert.assertNotNull("Timed out waiting for SchedulerApplicationAttempt=" +
    attemptId + " to be added.", ((AbstractYarnScheduler)
      rm.getResourceScheduler()).getApplicationAttempt(attemptId));
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:19,代码来源:MockRM.java


示例4: waitForNumContainersToRecover

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
public static void waitForNumContainersToRecover(int num, MockRM rm,
    ApplicationAttemptId attemptId) throws Exception {
  AbstractYarnScheduler scheduler =
      (AbstractYarnScheduler) rm.getResourceScheduler();
  SchedulerApplicationAttempt attempt =
      scheduler.getApplicationAttempt(attemptId);
  while (attempt == null) {
    System.out.println("Wait for scheduler attempt " + attemptId
        + " to be created");
    Thread.sleep(200);
    attempt = scheduler.getApplicationAttempt(attemptId);
  }
  while (attempt.getLiveContainers().size() < num) {
    System.out.println("Wait for " + num
        + " containers to recover. currently: "
        + attempt.getLiveContainers().size());
    Thread.sleep(200);
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:21,代码来源:TestWorkPreservingRMRestartForNodeLabel.java


示例5: waitForAppRemovedFromScheduler

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler; //导入依赖的package包/类
/**
 * Wait until an app is removed from scheduler.
 * @param appId the id of an app
 * @param timeoutMsecs the length of timeout in milliseconds
 * @throws InterruptedException
 *         if interrupted while waiting for app removed
 */
public void waitForAppRemovedFromScheduler(ApplicationId appId,
    long timeoutMsecs) throws InterruptedException {
  int timeWaiting = 0;

  Map<ApplicationId, SchedulerApplication> apps  =
      ((AbstractYarnScheduler) getResourceScheduler())
          .getSchedulerApplications();
  while (apps.containsKey(appId)) {
    if (timeWaiting >= timeoutMsecs) {
      break;
    }
    LOG.info("wait for app removed, " + appId);
    Thread.sleep(WAIT_MS_PER_LOOP);
    timeWaiting += WAIT_MS_PER_LOOP;
  }
  Assert.assertTrue("app is not removed from scheduler (timeout).",
      !apps.containsKey(appId));
  LOG.info("app is removed from scheduler, " + appId);
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:27,代码来源:MockRM.java


示例6: waitForNumContainersToRecover

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler; //导入依赖的package包/类
public static void waitForNumContainersToRecover(int num, MockRM rm,
    ApplicationAttemptId attemptId) throws Exception {
  AbstractYarnScheduler scheduler =
      (AbstractYarnScheduler) rm.getResourceScheduler();
  SchedulerApplicationAttempt attempt =
      scheduler.getApplicationAttempt(attemptId);
  while (attempt == null) {
    LOG.info("Wait for scheduler attempt " + attemptId
        + " to be created");
    Thread.sleep(200);
    attempt = scheduler.getApplicationAttempt(attemptId);
  }
  while (attempt.getLiveContainers().size() < num) {
    LOG.info("Wait for " + num
        + " containers to recover. currently: "
        + attempt.getLiveContainers().size());
    Thread.sleep(200);
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:20,代码来源:TestWorkPreservingRMRestart.java


示例7: NMHeartBeatHandler

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler; //导入依赖的package包/类
@Inject
public NMHeartBeatHandler(InterceptorRegistry registry, AbstractYarnScheduler yarnScheduler, MyriadDriver myriadDriver,
                          YarnNodeCapacityManager yarnNodeCapacityMgr, OfferLifecycleManager offerLifecycleMgr,
                          NodeStore nodeStore, SchedulerState state, NodeManagerConfiguration conf) {

  if (registry != null) {
    registry.register(this);
  }

  this.yarnScheduler = yarnScheduler;
  this.myriadDriver = myriadDriver;
  this.yarnNodeCapacityMgr = yarnNodeCapacityMgr;
  this.offerLifecycleMgr = offerLifecycleMgr;
  this.nodeStore = nodeStore;
  this.state = state;
  this.conf = conf;
}
 
开发者ID:apache,项目名称:incubator-myriad,代码行数:18,代码来源:NMHeartBeatHandler.java


示例8: generateRMContext

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler; //导入依赖的package包/类
private RMContext generateRMContext(AbstractYarnScheduler<FiCaSchedulerApp, FiCaSchedulerNode> scheduler) throws Exception {
  Configuration conf = new Configuration();
  MockRMContext context = null;
  Dispatcher dispatcher = new MockDispatcher();

  RMApplicationHistoryWriter rmApplicationHistoryWriter = new RMApplicationHistoryWriter(); 
  AMLivelinessMonitor amLivelinessMonitor = new AMLivelinessMonitor(dispatcher);
  AMLivelinessMonitor amFinishingMonitor = new AMLivelinessMonitor(dispatcher);    
  RMDelegationTokenSecretManager delegationTokenSecretManager = new RMDelegationTokenSecretManager(1, 1, 1, 1, context);

  context = new MockRMContext();
  context.setStateStore(TestObjectFactory.getStateStore(conf, "tmp/myriad-operations-test"));
  context.setAmLivelinessMonitor(amLivelinessMonitor);
  context.setAmFinishingMonitor(amFinishingMonitor);
  context.setRMApplicationHistoryWriter(rmApplicationHistoryWriter);
  context.setRMDelegationTokenSecretManager(delegationTokenSecretManager);
  return context;
}
 
开发者ID:apache,项目名称:incubator-myriad,代码行数:19,代码来源:MyriadOperationsTest.java


示例9: mockRMContext

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler; //导入依赖的package包/类
private static RMContext mockRMContext(List<RMAppState> states) {
  final ConcurrentMap<ApplicationId, RMApp> applicationsMaps = Maps
      .newConcurrentMap();
  int i = 0;
  for (RMAppState state : states) {
    MockRMApp app = new MockRMApp(i, i, state) {
      @Override
      public RMAppMetrics getRMAppMetrics() {
        return new RMAppMetrics(Resource.newInstance(0, 0, 0), 0, 0, 0, 0, 0);
      }
      @Override
      public YarnApplicationState createApplicationState() {
        return YarnApplicationState.ACCEPTED;
      }
    };
    RMAppAttempt attempt = mock(RMAppAttempt.class);
    app.setCurrentAppAttempt(attempt);
    applicationsMaps.put(app.getApplicationId(), app);
    i++;
  }

  RMContextImpl rmContext =  new RMContextImpl(null, null, null, null,
      null, null, null, null, null, null) {
    @Override
    public ConcurrentMap<ApplicationId, RMApp> getRMApps() {
      return applicationsMaps;
    }
    @Override
    public ResourceScheduler getScheduler() {
      return mock(AbstractYarnScheduler.class);
    }
  };
  return rmContext;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:35,代码来源:TestRMWebAppFairScheduler.java


示例10: initializeRMContext

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler; //导入依赖的package包/类
public static void initializeRMContext(int numContainers,
    AbstractYarnScheduler scheduler, RMContext mockRMContext) {

  when(mockRMContext.getScheduler()).thenReturn(scheduler);
  Resource r = calculateClusterResource(numContainers);
  doReturn(r).when(scheduler).getClusterResource();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:ReservationSystemTestUtil.java


示例11: testAddAndRemoveAppFromFiFoScheduler

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler; //导入依赖的package包/类
@Test
public void testAddAndRemoveAppFromFiFoScheduler() throws Exception {
  Configuration conf = new Configuration();
  conf.setClass(YarnConfiguration.RM_SCHEDULER, FifoScheduler.class,
    ResourceScheduler.class);
  MockRM rm = new MockRM(conf);
  @SuppressWarnings("unchecked")
  AbstractYarnScheduler<SchedulerApplicationAttempt, SchedulerNode> fs =
      (AbstractYarnScheduler<SchedulerApplicationAttempt, SchedulerNode>) rm
        .getResourceScheduler();
  TestSchedulerUtils.verifyAppAddedAndRemovedFromScheduler(
    fs.getSchedulerApplications(), fs, "queue");
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:TestFifoScheduler.java


示例12: testAddAndRemoveAppFromFairScheduler

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler; //导入依赖的package包/类
@Test
public void testAddAndRemoveAppFromFairScheduler() throws Exception {
  AbstractYarnScheduler<SchedulerApplicationAttempt, SchedulerNode> scheduler =
      (AbstractYarnScheduler<SchedulerApplicationAttempt, SchedulerNode>) resourceManager
        .getResourceScheduler();
  TestSchedulerUtils.verifyAppAddedAndRemovedFromScheduler(
    scheduler.getSchedulerApplications(), scheduler, "default");
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:TestFairScheduler.java


示例13: testContainersNotRecoveredForCompletedApps

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler; //导入依赖的package包/类
@Test(timeout = 20000)
public void testContainersNotRecoveredForCompletedApps() throws Exception {
  MemoryRMStateStore memStore = new MemoryRMStateStore();
  memStore.init(conf);
  rm1 = new MockRM(conf, memStore);
  rm1.start();
  MockNM nm1 =
      new MockNM("127.0.0.1:1234", 8192, rm1.getResourceTrackerService());
  nm1.registerNode();
  RMApp app1 = rm1.submitApp(200);
  MockAM am1 = MockRM.launchAndRegisterAM(app1, rm1, nm1);
  MockRM.finishAMAndVerifyAppState(app1, rm1, nm1, am1);

  rm2 = new MockRM(conf, memStore);
  rm2.start();
  nm1.setResourceTrackerService(rm2.getResourceTrackerService());
  NMContainerStatus runningContainer =
      TestRMRestart.createNMContainerStatus(am1.getApplicationAttemptId(), 2,
        ContainerState.RUNNING);
  NMContainerStatus completedContainer =
      TestRMRestart.createNMContainerStatus(am1.getApplicationAttemptId(), 3,
        ContainerState.COMPLETE);
  nm1.registerNode(Arrays.asList(runningContainer, completedContainer), null);
  RMApp recoveredApp1 =
      rm2.getRMContext().getRMApps().get(app1.getApplicationId());
  assertEquals(RMAppState.FINISHED, recoveredApp1.getState());

  // Wait for RM to settle down on recovering containers;
  Thread.sleep(3000);

  AbstractYarnScheduler scheduler =
      (AbstractYarnScheduler) rm2.getResourceScheduler();

  // scheduler should not recover containers for finished apps.
  assertNull(scheduler.getRMContainer(runningContainer.getContainerId()));
  assertNull(scheduler.getRMContainer(completedContainer.getContainerId()));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:38,代码来源:TestWorkPreservingRMRestart.java


示例14: testAMContainerStatusWithRMRestart

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler; //导入依赖的package包/类
@Test (timeout = 30000)
public void testAMContainerStatusWithRMRestart() throws Exception {  
  MemoryRMStateStore memStore = new MemoryRMStateStore();
  memStore.init(conf);
  rm1 = new MockRM(conf, memStore);
  rm1.start();
  MockNM nm1 =
      new MockNM("127.0.0.1:1234", 8192, rm1.getResourceTrackerService());
  nm1.registerNode();
  RMApp app1_1 = rm1.submitApp(1024);
  MockAM am1_1 = MockRM.launchAndRegisterAM(app1_1, rm1, nm1);
  
  RMAppAttempt attempt0 = app1_1.getCurrentAppAttempt();
  AbstractYarnScheduler scheduler =
      ((AbstractYarnScheduler) rm1.getResourceScheduler());
  
  Assert.assertTrue(scheduler.getRMContainer(
      attempt0.getMasterContainer().getId()).isAMContainer());

  // Re-start RM
  rm2 = new MockRM(conf, memStore);
  rm2.start();
  nm1.setResourceTrackerService(rm2.getResourceTrackerService());

  List<NMContainerStatus> am1_1Containers =
      createNMContainerStatusForApp(am1_1);
  nm1.registerNode(am1_1Containers, null);

  // Wait for RM to settle down on recovering containers;
  waitForNumContainersToRecover(2, rm2, am1_1.getApplicationAttemptId());

  scheduler = ((AbstractYarnScheduler) rm2.getResourceScheduler());
  Assert.assertTrue(scheduler.getRMContainer(
      attempt0.getMasterContainer().getId()).isAMContainer());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:36,代码来源:TestWorkPreservingRMRestart.java


示例15: testRecoverSchedulerAppAndAttemptSynchronously

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler; //导入依赖的package包/类
@Test (timeout = 20000)
public void testRecoverSchedulerAppAndAttemptSynchronously() throws Exception {
  // start RM
  MemoryRMStateStore memStore = new MemoryRMStateStore();
  memStore.init(conf);
  rm1 = new MockRM(conf, memStore);
  rm1.start();
  MockNM nm1 =
      new MockNM("127.0.0.1:1234", 15120, rm1.getResourceTrackerService());
  nm1.registerNode();

  // create app and launch the AM
  RMApp app0 = rm1.submitApp(200);
  MockAM am0 = MockRM.launchAndRegisterAM(app0, rm1, nm1);

  rm2 = new MockRM(conf, memStore);
  rm2.start();
  nm1.setResourceTrackerService(rm2.getResourceTrackerService());
  // scheduler app/attempt is immediately available after RM is re-started.
  Assert.assertNotNull(rm2.getResourceScheduler().getSchedulerAppInfo(
    am0.getApplicationAttemptId()));

  // getTransferredContainers should not throw NPE.
  ((AbstractYarnScheduler) rm2.getResourceScheduler())
    .getTransferredContainers(am0.getApplicationAttemptId());

  List<NMContainerStatus> containers = createNMContainerStatusForApp(am0);
  nm1.registerNode(containers, null);
  waitForNumContainersToRecover(2, rm2, am0.getApplicationAttemptId());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:31,代码来源:TestWorkPreservingRMRestart.java


示例16: serviceInit

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void serviceInit(Configuration conf) throws Exception {
  ((AbstractYarnScheduler<SchedulerApplicationAttempt, SchedulerNode>)
      scheduler).init(conf);
  super.serviceInit(conf);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:ResourceSchedulerWrapper.java


示例17: serviceStart

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void serviceStart() throws Exception {
  ((AbstractYarnScheduler<SchedulerApplicationAttempt, SchedulerNode>)
      scheduler).start();
  super.serviceStart();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:ResourceSchedulerWrapper.java


示例18: serviceStop

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void serviceStop() throws Exception {
  ((AbstractYarnScheduler<SchedulerApplicationAttempt, SchedulerNode>)
      scheduler).stop();
  super.serviceStop();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:ResourceSchedulerWrapper.java


示例19: AppAttemptInfo

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler; //导入依赖的package包/类
public AppAttemptInfo(ResourceManager rm, RMAppAttempt attempt, String user,
    String schemePrefix) {
  this.startTime = 0;
  this.containerId = "";
  this.nodeHttpAddress = "";
  this.nodeId = "";
  this.logsLink = "";
  this.blacklistedNodes = "";
  if (attempt != null) {
    this.id = attempt.getAppAttemptId().getAttemptId();
    this.startTime = attempt.getStartTime();
    Container masterContainer = attempt.getMasterContainer();
    if (masterContainer != null) {
      this.containerId = masterContainer.getId().toString();
      this.nodeHttpAddress = masterContainer.getNodeHttpAddress();
      this.nodeId = masterContainer.getNodeId().toString();
      this.logsLink = WebAppUtils.getRunningLogURL(schemePrefix
          + masterContainer.getNodeHttpAddress(),
          ConverterUtils.toString(masterContainer.getId()), user);
      if (rm.getResourceScheduler() instanceof AbstractYarnScheduler) {
        AbstractYarnScheduler ayScheduler =
            (AbstractYarnScheduler) rm.getResourceScheduler();
        SchedulerApplicationAttempt sattempt =
            ayScheduler.getApplicationAttempt(attempt.getAppAttemptId());
        if (sattempt != null) {
          blacklistedNodes =
              StringUtils.join(sattempt.getBlacklistedNodes(), ", ");
        }
      }
    }
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:33,代码来源:AppAttemptInfo.java


示例20: getBlacklistedNodes

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler; //导入依赖的package包/类
public static Set<String> getBlacklistedNodes(ResourceManager rm,
    ApplicationAttemptId appid) {
  if (rm.getResourceScheduler() instanceof AbstractYarnScheduler) {
    AbstractYarnScheduler ayScheduler =
        (AbstractYarnScheduler) rm.getResourceScheduler();
    SchedulerApplicationAttempt attempt =
        ayScheduler.getApplicationAttempt(appid);
    if (attempt != null) {
      return attempt.getBlacklistedNodes();
    }
  }
  return null;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:14,代码来源:RMAppAttemptBlock.java



注:本文中的org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HelpManager类代码示例发布时间:2022-05-23
下一篇:
Java Type类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap