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

Java ApplicationEventType类代码示例

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

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



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

示例1: run

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEventType; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void run() {
  List<String> rootLogDirs =
      NonAggregatingLogHandler.this.dirsHandler.getLogDirs();
  Path[] localAppLogDirs = new Path[rootLogDirs.size()];
  int index = 0;
  for (String rootLogDir : rootLogDirs) {
    localAppLogDirs[index] = new Path(rootLogDir, applicationId.toString());
    index++;
  }
  // Inform the application before the actual delete itself, so that links
  // to logs will no longer be there on NM web-UI. 
  NonAggregatingLogHandler.this.dispatcher.getEventHandler().handle(
      new ApplicationEvent(this.applicationId,
          ApplicationEventType.APPLICATION_LOG_HANDLING_FINISHED));
  NonAggregatingLogHandler.this.delService.delete(user, null,
      localAppLogDirs);
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:20,代码来源:NonAggregatingLogHandler.java


示例2: run

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEventType; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void run() {
  try {
    doAppLogAggregation();
  } catch (Exception e) {
    // do post clean up of log directories on any exception
    LOG.error("Error occured while aggregating the log for the application "
        + appId, e);
    doAppLogAggregationPostCleanUp();
  } finally {
    if (!this.appAggregationFinished.get() && !this.aborted.get()) {
      LOG.warn("Log aggregation did not complete for application " + appId);
      this.dispatcher.getEventHandler().handle(
          new ApplicationEvent(this.appId,
              ApplicationEventType.APPLICATION_LOG_HANDLING_FAILED));
    }
    this.appAggregationFinished.set(true);
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:21,代码来源:AppLogAggregatorImpl.java


示例3: stopApp

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEventType; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void stopApp(ApplicationId appId) {

  // App is complete. Finish up any containers' pending log aggregation and
  // close the application specific logFile.

  AppLogAggregator aggregator = this.appLogAggregators.get(appId);
  if (aggregator == null) {
    LOG.warn("Log aggregation is not initialized for " + appId
        + ", did it fail to start?");
    this.dispatcher.getEventHandler().handle(
        new ApplicationEvent(appId,
            ApplicationEventType.APPLICATION_LOG_HANDLING_FAILED));
    return;
  }
  aggregator.finishLogAggregation();
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:18,代码来源:LogAggregationService.java


示例4: run

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEventType; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void run() {
  List<Path> localAppLogDirs = new ArrayList<Path>();
  FileContext lfs = getLocalFileContext(getConfig());
  for (String rootLogDir : dirsHandler.getLogDirsForCleanup()) {
    Path logDir = new Path(rootLogDir, applicationId.toString());
    try {
      lfs.getFileStatus(logDir);
      localAppLogDirs.add(logDir);
    } catch (UnsupportedFileSystemException ue) {
      LOG.warn("Unsupported file system used for log dir " + logDir, ue);
      continue;
    } catch (IOException ie) {
      continue;
    }
  }

  // Inform the application before the actual delete itself, so that links
  // to logs will no longer be there on NM web-UI.
  NonAggregatingLogHandler.this.dispatcher.getEventHandler().handle(
    new ApplicationEvent(this.applicationId,
      ApplicationEventType.APPLICATION_LOG_HANDLING_FINISHED));
  if (localAppLogDirs.size() > 0) {
    NonAggregatingLogHandler.this.delService.delete(user, null,
      (Path[]) localAppLogDirs.toArray(new Path[localAppLogDirs.size()]));
  }
  try {
    NonAggregatingLogHandler.this.stateStore.removeLogDeleter(
        this.applicationId);
  } catch (IOException e) {
    LOG.error("Error removing log deletion state", e);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:35,代码来源:NonAggregatingLogHandler.java


示例5: doAppLogAggregation

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEventType; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void doAppLogAggregation() {
  while (!this.appFinishing.get() && !this.aborted.get()) {
    synchronized(this) {
      try {
        waiting.set(true);
        if (logAggregationInRolling) {
          wait(this.rollingMonitorInterval * 1000);
          if (this.appFinishing.get() || this.aborted.get()) {
            break;
          }
          uploadLogsForContainers(false);
        } else {
          wait(THREAD_SLEEP_TIME);
        }
      } catch (InterruptedException e) {
        LOG.warn("PendingContainers queue is interrupted");
        this.appFinishing.set(true);
      }
    }
  }

  if (this.aborted.get()) {
    return;
  }

  // App is finished, upload the container logs.
  uploadLogsForContainers(true);

  doAppLogAggregationPostCleanUp();

  this.dispatcher.getEventHandler().handle(
      new ApplicationEvent(this.appId,
          ApplicationEventType.APPLICATION_LOG_HANDLING_FINISHED));
  this.appAggregationFinished.set(true);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:37,代码来源:AppLogAggregatorImpl.java


示例6: setup

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEventType; //导入依赖的package包/类
@Before
@SuppressWarnings("unchecked")
public void setup() {
  mockDelService = mock(DeletionService.class);
  conf = new YarnConfiguration();
  dispatcher = createDispatcher(conf);
  appEventHandler = mock(EventHandler.class);
  dispatcher.register(ApplicationEventType.class, appEventHandler);
  appId = BuilderUtils.newApplicationId(1234, 1);
  appAttemptId = BuilderUtils.newApplicationAttemptId(appId, 1);
  container11 = BuilderUtils.newContainerId(appAttemptId, 1);
  dirsHandler = new LocalDirsHandlerService();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:TestNonAggregatingLogHandler.java


示例7: setup

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEventType; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void setup() throws IOException {
  super.setup();
  NodeId nodeId = NodeId.newInstance("0.0.0.0", 5555);
  ((NMContext)context).setNodeId(nodeId);
  dispatcher = createDispatcher();
  appEventHandler = mock(EventHandler.class);
  dispatcher.register(ApplicationEventType.class, appEventHandler);
  UserGroupInformation.setConfiguration(conf);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:TestLogAggregationService.java


示例8: AMRMProxyService

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEventType; //导入依赖的package包/类
/**
 * Creates an instance of the service.
 * 
 * @param nmContext
 * @param dispatcher
 */
public AMRMProxyService(Context nmContext, AsyncDispatcher dispatcher) {
  super(AMRMProxyService.class.getName());
  Preconditions.checkArgument(nmContext != null, "nmContext is null");
  Preconditions.checkArgument(dispatcher != null, "dispatcher is null");
  this.nmContext = nmContext;
  this.dispatcher = dispatcher;
  this.applPipelineMap =
      new ConcurrentHashMap<ApplicationId, RequestInterceptorChainWrapper>();

  this.dispatcher.register(ApplicationEventType.class,
      new ApplicationEventHandler());
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:19,代码来源:AMRMProxyService.java


示例9: finishApplication

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEventType; //导入依赖的package包/类
private void finishApplication(ApplicationId appId,
    LogAggregationService logAggregationService) throws Exception {
  dispatcher.await();
  ApplicationEvent expectedInitEvents[] =
      new ApplicationEvent[] { new ApplicationEvent(appId,
          ApplicationEventType.APPLICATION_LOG_HANDLING_INITED) };
  checkEvents(appEventHandler, expectedInitEvents, false, "getType",
      "getApplicationID");
  reset(appEventHandler);

  logAggregationService.handle(new LogHandlerAppFinishedEvent(appId));
  logAggregationService.stop();
  assertEquals(0, logAggregationService.getNumAggregators());
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:15,代码来源:TestLogAggregationService.java


示例10: verifyLogAggFinishEvent

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEventType; //导入依赖的package包/类
private void verifyLogAggFinishEvent(ApplicationId appId) throws Exception {
  dispatcher.await();

  ApplicationEvent[] expectedFinishedEvents =
      new ApplicationEvent[] { new ApplicationEvent(appId,
          ApplicationEventType.APPLICATION_LOG_HANDLING_FINISHED) };
  checkEvents(appEventHandler, expectedFinishedEvents, false, "getType",
          "getApplicationID");
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:10,代码来源:TestLogAggregationService.java


示例11: handle

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEventType; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void handle(LogHandlerEvent event) {
  switch (event.getType()) {
    case APPLICATION_STARTED:
      LogHandlerAppStartedEvent appStartedEvent =
          (LogHandlerAppStartedEvent) event;
      this.appOwners.put(appStartedEvent.getApplicationId(),
          appStartedEvent.getUser());
      this.dispatcher.getEventHandler().handle(
          new ApplicationEvent(appStartedEvent.getApplicationId(),
              ApplicationEventType.APPLICATION_LOG_HANDLING_INITED));
      break;
    case CONTAINER_FINISHED:
      // Ignore
      break;
    case APPLICATION_FINISHED:
      LogHandlerAppFinishedEvent appFinishedEvent =
          (LogHandlerAppFinishedEvent) event;
      // Schedule - so that logs are available on the UI till they're deleted.
      LOG.info("Scheduling Log Deletion for application: "
          + appFinishedEvent.getApplicationId() + ", with delay of "
          + this.deleteDelaySeconds + " seconds");
      LogDeleterRunnable logDeleter =
          new LogDeleterRunnable(appOwners.remove(appFinishedEvent
                .getApplicationId()), appFinishedEvent.getApplicationId());
      try {
        sched.schedule(logDeleter, this.deleteDelaySeconds,
            TimeUnit.SECONDS);
      } catch (RejectedExecutionException e) {
        // Handling this event in local thread before starting threads
        // or after calling sched.shutdownNow().
        logDeleter.run();
      }
      break;
    default:
      ; // Ignore
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:40,代码来源:NonAggregatingLogHandler.java


示例12: run

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEventType; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void run() {
  List<Path> localAppLogDirs = new ArrayList<Path>();
  FileContext lfs = getLocalFileContext(getConfig());
  for (String rootLogDir : dirsHandler.getLogDirsForCleanup()) {
    Path logDir = new Path(rootLogDir, applicationId.toString());
    try {
      lfs.getFileStatus(logDir);
      localAppLogDirs.add(logDir);
    } catch (UnsupportedFileSystemException ue) {
      LOG.warn("Unsupported file system used for log dir " + logDir, ue);
      continue;
    } catch (IOException ie) {
      continue;
    }
  }

  // Inform the application before the actual delete itself, so that links
  // to logs will no longer be there on NM web-UI.
  NonAggregatingLogHandler.this.dispatcher.getEventHandler().handle(
    new ApplicationEvent(this.applicationId,
      ApplicationEventType.APPLICATION_LOG_HANDLING_FINISHED));
  if (localAppLogDirs.size() > 0) {
    NonAggregatingLogHandler.this.delService.delete(user, null,
      (Path[]) localAppLogDirs.toArray(new Path[localAppLogDirs.size()]));
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:29,代码来源:NonAggregatingLogHandler.java


示例13: handleDestroyApplicationResources

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEventType; //导入依赖的package包/类
@SuppressWarnings({"unchecked"})
private void handleDestroyApplicationResources(Application application) {
  String userName;
  String appIDStr;
  LocalResourcesTracker appLocalRsrcsTracker =
    appRsrc.remove(ConverterUtils.toString(application.getAppId()));
  if (null == appLocalRsrcsTracker) {
    LOG.warn("Removing uninitialized application " + application);
  }
  // TODO: What to do with appLocalRsrcsTracker?

  // Delete the application directories
  userName = application.getUser();
  appIDStr = application.toString();
  for (String localDir : dirsHandler.getLocalDirs()) {

    // Delete the user-owned app-dir
    Path usersdir = new Path(localDir, ContainerLocalizer.USERCACHE);
    Path userdir = new Path(usersdir, userName);
    Path allAppsdir = new Path(userdir, ContainerLocalizer.APPCACHE);
    Path appDir = new Path(allAppsdir, appIDStr);
    delService.delete(userName, appDir, new Path[] {});

    // Delete the nmPrivate app-dir
    Path sysDir = new Path(localDir, NM_PRIVATE_DIR);
    Path appSysDir = new Path(sysDir, appIDStr);
    delService.delete(null, appSysDir, new Path[] {});
  }

  // TODO: decrement reference counts of all resources associated with this
  // app

  dispatcher.getEventHandler().handle(new ApplicationEvent(
        application.getAppId(),
        ApplicationEventType.APPLICATION_RESOURCES_CLEANEDUP));
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:37,代码来源:ResourceLocalizationService.java


示例14: handle

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEventType; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void handle(LogHandlerEvent event) {
  switch (event.getType()) {
    case APPLICATION_STARTED:
      LogHandlerAppStartedEvent appStartedEvent =
          (LogHandlerAppStartedEvent) event;
      this.appOwners.put(appStartedEvent.getApplicationId(),
          appStartedEvent.getUser());
      this.dispatcher.getEventHandler().handle(
          new ApplicationEvent(appStartedEvent.getApplicationId(),
              ApplicationEventType.APPLICATION_LOG_HANDLING_INITED));
      break;
    case CONTAINER_FINISHED:
      // Ignore
      break;
    case APPLICATION_FINISHED:
      LogHandlerAppFinishedEvent appFinishedEvent =
          (LogHandlerAppFinishedEvent) event;
      // Schedule - so that logs are available on the UI till they're deleted.
      LOG.info("Scheduling Log Deletion for application: "
          + appFinishedEvent.getApplicationId() + ", with delay of "
          + this.deleteDelaySeconds + " seconds");
      sched.schedule(
          new LogDeleterRunnable(appOwners.remove(appFinishedEvent
              .getApplicationId()), appFinishedEvent.getApplicationId()),
          this.deleteDelaySeconds, TimeUnit.SECONDS);
      break;
    default:
      ; // Ignore
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:33,代码来源:NonAggregatingLogHandler.java


示例15: testStopAfterError

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEventType; //导入依赖的package包/类
@Test(timeout=20000)
@SuppressWarnings("unchecked")
public void testStopAfterError() throws Exception {
  DeletionService delSrvc = mock(DeletionService.class);

  // get the AppLogAggregationImpl thread to crash
  LocalDirsHandlerService mockedDirSvc = mock(LocalDirsHandlerService.class);
  when(mockedDirSvc.getLogDirs()).thenThrow(new RuntimeException());

  DrainDispatcher dispatcher = createDispatcher();
  EventHandler<ApplicationEvent> appEventHandler = mock(EventHandler.class);
  dispatcher.register(ApplicationEventType.class, appEventHandler);

  LogAggregationService logAggregationService =
      new LogAggregationService(dispatcher, this.context, delSrvc,
                                mockedDirSvc);
  logAggregationService.init(this.conf);
  logAggregationService.start();

  ApplicationId application1 = BuilderUtils.newApplicationId(1234, 1);
  logAggregationService.handle(new LogHandlerAppStartedEvent(
          application1, this.user, null,
          ContainerLogsRetentionPolicy.ALL_CONTAINERS, this.acls));

  logAggregationService.stop();
  assertEquals(0, logAggregationService.getNumAggregators());
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:28,代码来源:TestLogAggregationService.java


示例16: testLogAggregatorCleanup

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEventType; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void testLogAggregatorCleanup() throws Exception {
  DeletionService delSrvc = mock(DeletionService.class);

  // get the AppLogAggregationImpl thread to crash
  LocalDirsHandlerService mockedDirSvc = mock(LocalDirsHandlerService.class);

  DrainDispatcher dispatcher = createDispatcher();
  EventHandler<ApplicationEvent> appEventHandler = mock(EventHandler.class);
  dispatcher.register(ApplicationEventType.class, appEventHandler);

  LogAggregationService logAggregationService =
      new LogAggregationService(dispatcher, this.context, delSrvc,
                                mockedDirSvc);
  logAggregationService.init(this.conf);
  logAggregationService.start();

  ApplicationId application1 = BuilderUtils.newApplicationId(1234, 1);
  logAggregationService.handle(new LogHandlerAppStartedEvent(
          application1, this.user, null,
          ContainerLogsRetentionPolicy.ALL_CONTAINERS, this.acls));

  logAggregationService.handle(new LogHandlerAppFinishedEvent(application1));
  dispatcher.await();
  int timeToWait = 20 * 1000;
  while (timeToWait > 0 && logAggregationService.getNumAggregators() > 0) {
    Thread.sleep(100);
    timeToWait -= 100;
  }
  Assert.assertEquals("Log aggregator failed to cleanup!", 0,
      logAggregationService.getNumAggregators());
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:34,代码来源:TestLogAggregationService.java


示例17: run

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEventType; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void run() {
  List<Path> localAppLogDirs = new ArrayList<Path>();
  FileContext lfs = getLocalFileContext(getConfig());
  for (String rootLogDir : dirsHandler.getLogDirsForCleanup()) {
    Path userLogDir = new Path(rootLogDir, userFolder);
    Path logDir = new Path(userLogDir, applicationId.toString());
    try {
      lfs.getFileStatus(logDir);
      localAppLogDirs.add(logDir);
    } catch (UnsupportedFileSystemException ue) {
      LOG.warn("Unsupported file system used for log dir " + logDir, ue);
      continue;
    } catch (IOException ie) {
      continue;
    }
  }

  // Inform the application before the actual delete itself, so that links
  // to logs will no longer be there on NM web-UI.
  NonAggregatingLogHandler.this.dispatcher.getEventHandler().handle(
    new ApplicationEvent(this.applicationId,
      ApplicationEventType.APPLICATION_LOG_HANDLING_FINISHED));
  if (localAppLogDirs.size() > 0) {
    NonAggregatingLogHandler.this.delService.delete(user, null,
      (Path[]) localAppLogDirs.toArray(new Path[localAppLogDirs.size()]));
  }
  try {
    NonAggregatingLogHandler.this.stateStore.removeLogDeleter(
        this.applicationId);
  } catch (IOException e) {
    LOG.error("Error removing log deletion state", e);
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:36,代码来源:NonAggregatingLogHandler.java


示例18: setup

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEventType; //导入依赖的package包/类
@Before
@SuppressWarnings("unchecked")
public void setup() {
  mockDelService = mock(DeletionService.class);
  conf = new YarnConfiguration();
  dispatcher = createDispatcher(conf);
  appEventHandler = new ApplicationEventHandler();
  dispatcher.register(ApplicationEventType.class, appEventHandler);
  appId = BuilderUtils.newApplicationId(1234, 1);
  appAttemptId = BuilderUtils.newApplicationAttemptId(appId, 1);
  container11 = BuilderUtils.newContainerId(appAttemptId, 1);
  dirsHandler = new LocalDirsHandlerService();
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:14,代码来源:TestNonAggregatingLogHandler.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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