当前位置: 首页>>代码示例>>Java>>正文


Java LocalizerTracker类代码示例

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


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

示例1: createSpyService

import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.ResourceLocalizationService.LocalizerTracker; //导入依赖的package包/类
private ResourceLocalizationService createSpyService(
    DrainDispatcher dispatcher, LocalDirsHandlerService dirsHandler,
    NMStateStoreService stateStore) {
  ContainerExecutor exec = mock(ContainerExecutor.class);
  LocalizerTracker mockLocalizerTracker = mock(LocalizerTracker.class);
  DeletionService delService = mock(DeletionService.class);
  NMContext nmContext =
      new NMContext(new NMContainerTokenSecretManager(conf),
        new NMTokenSecretManagerInNM(), null,
        new ApplicationACLsManager(conf), stateStore);
  ResourceLocalizationService rawService =
    new ResourceLocalizationService(dispatcher, exec, delService,
                                    dirsHandler, nmContext);
  ResourceLocalizationService spyService = spy(rawService);
  doReturn(mockServer).when(spyService).createServer();
  doReturn(mockLocalizerTracker).when(spyService).createLocalizerTracker(
      isA(Configuration.class));
  doReturn(lfs).when(spyService)
      .getLocalFileContext(isA(Configuration.class));
  return spyService;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:TestResourceLocalizationService.java

示例2: createSpyService

import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.ResourceLocalizationService.LocalizerTracker; //导入依赖的package包/类
private ResourceLocalizationService createSpyService(
    DrainDispatcher dispatcher, LocalDirsHandlerService dirsHandler,
    NMStateStoreService stateStore) {
  ContainerExecutor exec = mock(ContainerExecutor.class);
  LocalizerTracker mockLocalizerTracker = mock(LocalizerTracker.class);
  DeletionService delService = mock(DeletionService.class);
  NMContext nmContext =
      new NMContext(new NMContainerTokenSecretManager(conf),
        new NMTokenSecretManagerInNM(), null,
        new ApplicationACLsManager(conf), stateStore,null);
  ResourceLocalizationService rawService =
    new ResourceLocalizationService(dispatcher, exec, delService,
                                    dirsHandler, nmContext);
  ResourceLocalizationService spyService = spy(rawService);
  doReturn(mockServer).when(spyService).createServer();
  doReturn(mockLocalizerTracker).when(spyService).createLocalizerTracker(
      isA(Configuration.class));
  doReturn(lfs).when(spyService)
      .getLocalFileContext(isA(Configuration.class));
  return spyService;
}
 
开发者ID:yncxcw,项目名称:big-c,代码行数:22,代码来源:TestResourceLocalizationService.java

示例3: testDirHandler

import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.ResourceLocalizationService.LocalizerTracker; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void testDirHandler() throws Exception {
  File f = new File(basedir.toString());
  String[] sDirs = new String[4];
  List<Path> localDirs = new ArrayList<Path>(sDirs.length);
  for (int i = 0; i < 4; ++i) {
    sDirs[i] = f.getAbsolutePath() + i;
    localDirs.add(new Path(sDirs[i]));
  }
  conf.setStrings(YarnConfiguration.NM_LOCAL_DIRS, sDirs);
  LocalizerTracker mockLocalizerTracker = mock(LocalizerTracker.class);
  DrainDispatcher dispatcher = new DrainDispatcher();
  dispatcher.init(conf);
  dispatcher.start();
  EventHandler<ApplicationEvent> applicationBus = mock(EventHandler.class);
  dispatcher.register(ApplicationEventType.class, applicationBus);
  EventHandler<LocalizerEvent> localizerBus = mock(EventHandler.class);
  dispatcher.register(LocalizerEventType.class, localizerBus);

  ContainerExecutor exec = mock(ContainerExecutor.class);
  LocalDirsHandlerService mockDirsHandler =
      mock(LocalDirsHandlerService.class);
  doReturn(new ArrayList<String>(Arrays.asList(sDirs))).when(
      mockDirsHandler).getLocalDirsForCleanup();
  // setup mocks
  DeletionService delService = mock(DeletionService.class);
  ResourceLocalizationService rawService =
      new ResourceLocalizationService(dispatcher, exec, delService,
          mockDirsHandler, nmContext);
  ResourceLocalizationService spyService = spy(rawService);
  doReturn(mockServer).when(spyService).createServer();
  doReturn(mockLocalizerTracker).when(spyService).createLocalizerTracker(
      isA(Configuration.class));

  final String user = "user0";
  // init application
  final Application app = mock(Application.class);
  final ApplicationId appId =
      BuilderUtils.newApplicationId(314159265358979L, 3);
  when(app.getUser()).thenReturn(user);
  when(app.getAppId()).thenReturn(appId);
  when(app.toString()).thenReturn(appId.toString());
  try {
    spyService.init(conf);
    spyService.start();

    spyService.handle(new ApplicationLocalizationEvent(
        LocalizationEventType.INIT_APPLICATION_RESOURCES, app));
    dispatcher.await();

    LocalResourcesTracker appTracker =
        spyService.getLocalResourcesTracker(
            LocalResourceVisibility.APPLICATION, user, appId);
    LocalResourcesTracker privTracker =
        spyService.getLocalResourcesTracker(LocalResourceVisibility.PRIVATE,
            user, appId);
    LocalResourcesTracker pubTracker =
        spyService.getLocalResourcesTracker(LocalResourceVisibility.PUBLIC,
            user, appId);
    Assert.assertNotNull("dirHandler for appTracker is null!",
        ((LocalResourcesTrackerImpl)appTracker).getDirsHandler());
    Assert.assertNotNull("dirHandler for privTracker is null!",
        ((LocalResourcesTrackerImpl)privTracker).getDirsHandler());
    Assert.assertNotNull("dirHandler for pubTracker is null!",
        ((LocalResourcesTrackerImpl)pubTracker).getDirsHandler());
  } finally {
    dispatcher.stop();
    delService.stop();
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:72,代码来源:TestResourceLocalizationService.java


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