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

Java ApplicationNotFoundException类代码示例

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

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



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

示例1: killApplication

import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException; //导入依赖的package包/类
public static void killApplication(String applicationId) throws Exception {
  try {
    YarnClient yarnClient = YarnClient.createYarnClient();
    yarnClient.init(conf);
    yarnClient.start();
    LOGGER.logInfo("[yarn application -kill %s]", applicationId);
    yarnClient.killApplication(ConverterUtils.toApplicationId(applicationId));
    yarnClient.stop();
  } catch (ApplicationNotFoundException ignored) {
  } catch (Exception e) {
    if (e.getMessage().toLowerCase().contains("invalid applicationid")) {
      // ignored
    } else {
      throw e;
    }
  }
}
 
开发者ID:Microsoft,项目名称:pai,代码行数:18,代码来源:HadoopUtils.java


示例2: testNonExistingApplicationReport

import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException; //导入依赖的package包/类
@Test
public void testNonExistingApplicationReport() throws YarnException {
  RMContext rmContext = mock(RMContext.class);
  when(rmContext.getRMApps()).thenReturn(
      new ConcurrentHashMap<ApplicationId, RMApp>());
  ClientRMService rmService = new ClientRMService(rmContext, null, null,
      null, null, null);
  RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
  GetApplicationReportRequest request = recordFactory
      .newRecordInstance(GetApplicationReportRequest.class);
  request.setApplicationId(ApplicationId.newInstance(0, 0));
  try {
    rmService.getApplicationReport(request);
    Assert.fail();
  } catch (ApplicationNotFoundException ex) {
    Assert.assertEquals(ex.getMessage(),
        "Application with id '" + request.getApplicationId()
            + "' doesn't exist in RM.");
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:TestClientRMService.java


示例3: testGetApplicationAttemptReport

import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException; //导入依赖的package包/类
@Test
public void testGetApplicationAttemptReport() throws YarnException,
    IOException {
  ClientRMService rmService = createRMService();
  RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
  GetApplicationAttemptReportRequest request = recordFactory
      .newRecordInstance(GetApplicationAttemptReportRequest.class);
  ApplicationAttemptId attemptId = ApplicationAttemptId.newInstance(
      ApplicationId.newInstance(123456, 1), 1);
  request.setApplicationAttemptId(attemptId);

  try {
    GetApplicationAttemptReportResponse response = rmService
        .getApplicationAttemptReport(request);
    Assert.assertEquals(attemptId, response.getApplicationAttemptReport()
        .getApplicationAttemptId());
  } catch (ApplicationNotFoundException ex) {
    Assert.fail(ex.getMessage());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:TestClientRMService.java


示例4: testGetApplicationAttempts

import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException; //导入依赖的package包/类
@Test
public void testGetApplicationAttempts() throws YarnException, IOException {
  ClientRMService rmService = createRMService();
  RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
  GetApplicationAttemptsRequest request = recordFactory
      .newRecordInstance(GetApplicationAttemptsRequest.class);
  ApplicationAttemptId attemptId = ApplicationAttemptId.newInstance(
      ApplicationId.newInstance(123456, 1), 1);
  request.setApplicationId(ApplicationId.newInstance(123456, 1));

  try {
    GetApplicationAttemptsResponse response = rmService
        .getApplicationAttempts(request);
    Assert.assertEquals(1, response.getApplicationAttemptList().size());
    Assert.assertEquals(attemptId, response.getApplicationAttemptList()
        .get(0).getApplicationAttemptId());

  } catch (ApplicationNotFoundException ex) {
    Assert.fail(ex.getMessage());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:TestClientRMService.java


示例5: testGetContainerReport

import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException; //导入依赖的package包/类
@Test
public void testGetContainerReport() throws YarnException, IOException {
  ClientRMService rmService = createRMService();
  RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
  GetContainerReportRequest request = recordFactory
      .newRecordInstance(GetContainerReportRequest.class);
  ApplicationAttemptId attemptId = ApplicationAttemptId.newInstance(
      ApplicationId.newInstance(123456, 1), 1);
  ContainerId containerId = ContainerId.newContainerId(attemptId, 1);
  request.setContainerId(containerId);

  try {
    GetContainerReportResponse response = rmService
        .getContainerReport(request);
    Assert.assertEquals(containerId, response.getContainerReport()
        .getContainerId());
  } catch (ApplicationNotFoundException ex) {
    Assert.fail(ex.getMessage());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:TestClientRMService.java


示例6: testGetContainers

import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException; //导入依赖的package包/类
@Test
public void testGetContainers() throws YarnException, IOException {
  ClientRMService rmService = createRMService();
  RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
  GetContainersRequest request = recordFactory
      .newRecordInstance(GetContainersRequest.class);
  ApplicationAttemptId attemptId = ApplicationAttemptId.newInstance(
      ApplicationId.newInstance(123456, 1), 1);
  ContainerId containerId = ContainerId.newContainerId(attemptId, 1);
  request.setApplicationAttemptId(attemptId);
  try {
    GetContainersResponse response = rmService.getContainers(request);
    Assert.assertEquals(containerId, response.getContainerList().get(0)
        .getContainerId());
  } catch (ApplicationNotFoundException ex) {
    Assert.fail(ex.getMessage());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:TestClientRMService.java


示例7: testForceKillNonExistingApplication

import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException; //导入依赖的package包/类
@Test
public void testForceKillNonExistingApplication() throws YarnException {
  RMContext rmContext = mock(RMContext.class);
  when(rmContext.getRMApps()).thenReturn(
      new ConcurrentHashMap<ApplicationId, RMApp>());
  ClientRMService rmService = new ClientRMService(rmContext, null, null,
      null, null, null);
  ApplicationId applicationId =
      BuilderUtils.newApplicationId(System.currentTimeMillis(), 0);
  KillApplicationRequest request =
      KillApplicationRequest.newInstance(applicationId);
  try {
    rmService.forceKillApplication(request);
    Assert.fail();
  } catch (ApplicationNotFoundException ex) {
    Assert.assertEquals(ex.getMessage(),
        "Trying to kill an absent " +
            "application " + request.getApplicationId());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:TestClientRMService.java


示例8: getApplicationReport

import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException; //导入依赖的package包/类
@Override
public ApplicationReport getApplicationReport(ApplicationId appId)
    throws YarnException, IOException {
  GetApplicationReportResponse response = null;
  try {
    GetApplicationReportRequest request = Records
        .newRecord(GetApplicationReportRequest.class);
    request.setApplicationId(appId);
    response = rmClient.getApplicationReport(request);
  } catch (YarnException e) {
    if (!historyServiceEnabled) {
      // Just throw it as usual if historyService is not enabled.
      throw e;
    }
    // Even if history-service is enabled, treat all exceptions still the same
    // except the following
    if (!(e.getClass() == ApplicationNotFoundException.class)) {
      throw e;
    }
    return historyClient.getApplicationReport(appId);
  }
  return response.getApplicationReport();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:YarnClientImpl.java


示例9: getApplicationAttemptReport

import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException; //导入依赖的package包/类
@Override
public ApplicationAttemptReport getApplicationAttemptReport(
    ApplicationAttemptId appAttemptId) throws YarnException, IOException {
  try {
    GetApplicationAttemptReportRequest request = Records
        .newRecord(GetApplicationAttemptReportRequest.class);
    request.setApplicationAttemptId(appAttemptId);
    GetApplicationAttemptReportResponse response = rmClient
        .getApplicationAttemptReport(request);
    return response.getApplicationAttemptReport();
  } catch (YarnException e) {
    if (!historyServiceEnabled) {
      // Just throw it as usual if historyService is not enabled.
      throw e;
    }
    // Even if history-service is enabled, treat all exceptions still the same
    // except the following
    if (e.getClass() != ApplicationNotFoundException.class) {
      throw e;
    }
    return historyClient.getApplicationAttemptReport(appAttemptId);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:YarnClientImpl.java


示例10: getApplicationAttempts

import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException; //导入依赖的package包/类
@Override
public List<ApplicationAttemptReport> getApplicationAttempts(
    ApplicationId appId) throws YarnException, IOException {
  try {
    GetApplicationAttemptsRequest request = Records
        .newRecord(GetApplicationAttemptsRequest.class);
    request.setApplicationId(appId);
    GetApplicationAttemptsResponse response = rmClient
        .getApplicationAttempts(request);
    return response.getApplicationAttemptList();
  } catch (YarnException e) {
    if (!historyServiceEnabled) {
      // Just throw it as usual if historyService is not enabled.
      throw e;
    }
    // Even if history-service is enabled, treat all exceptions still the same
    // except the following
    if (e.getClass() != ApplicationNotFoundException.class) {
      throw e;
    }
    return historyClient.getApplicationAttempts(appId);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:YarnClientImpl.java


示例11: getContainerReport

import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException; //导入依赖的package包/类
@Override
public ContainerReport getContainerReport(ContainerId containerId)
    throws YarnException, IOException {
  try {
    GetContainerReportRequest request = Records
        .newRecord(GetContainerReportRequest.class);
    request.setContainerId(containerId);
    GetContainerReportResponse response = rmClient
        .getContainerReport(request);
    return response.getContainerReport();
  } catch (YarnException e) {
    if (!historyServiceEnabled) {
      // Just throw it as usual if historyService is not enabled.
      throw e;
    }
    // Even if history-service is enabled, treat all exceptions still the same
    // except the following
    if (e.getClass() != ApplicationNotFoundException.class
        && e.getClass() != ContainerNotFoundException.class) {
      throw e;
    }
    return historyClient.getContainerReport(containerId);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:YarnClientImpl.java


示例12: killApplication

import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException; //导入依赖的package包/类
/**
 * Kills the application with the application id as appId
 * 
 * @param applicationId
 * @throws YarnException
 * @throws IOException
 */
private void killApplication(String applicationId) throws YarnException,
    IOException {
  ApplicationId appId = ConverterUtils.toApplicationId(applicationId);
  ApplicationReport  appReport = null;
  try {
    appReport = client.getApplicationReport(appId);
  } catch (ApplicationNotFoundException e) {
    sysout.println("Application with id '" + applicationId +
        "' doesn't exist in RM.");
    throw e;
  }

  if (appReport.getYarnApplicationState() == YarnApplicationState.FINISHED
      || appReport.getYarnApplicationState() == YarnApplicationState.KILLED
      || appReport.getYarnApplicationState() == YarnApplicationState.FAILED) {
    sysout.println("Application " + applicationId + " has already finished ");
  } else {
    sysout.println("Killing application " + applicationId);
    client.killApplication(appId);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:29,代码来源:ApplicationCLI.java


示例13: getContainer

import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException; //导入依赖的package包/类
private ContainerReport getContainer(
    ContainerId containerId,
    HashMap<ApplicationAttemptId, List<ContainerReport>> containersToAppAttemptMapping)
    throws YarnException, IOException {
  List<ContainerReport> containersForAppAttempt =
      containersToAppAttemptMapping.get(containerId
          .getApplicationAttemptId());
  if (containersForAppAttempt == null) {
    throw new ApplicationNotFoundException(containerId
        .getApplicationAttemptId().getApplicationId() + " is not found ");
  }
  Iterator<ContainerReport> iterator = containersForAppAttempt.iterator();
  while (iterator.hasNext()) {
    ContainerReport next = iterator.next();
    if (next.getContainerId().equals(containerId)) {
      return next;
    }
  }
  throw new ContainerNotFoundException(containerId + " is not found ");
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:TestYarnClient.java


示例14: getApplicationReport

import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException; //导入依赖的package包/类
/**
 * Get an application report for the specified application id from the RM and
 * fall back to the Application History Server if not found in RM.
 * @param appId id of the application to get.
 * @return the ApplicationReport for the appId.
 * @throws YarnException on any error.
 * @throws IOException
 */
public FetchedAppReport getApplicationReport(ApplicationId appId)
throws YarnException, IOException {
  GetApplicationReportRequest request = recordFactory
      .newRecordInstance(GetApplicationReportRequest.class);
  request.setApplicationId(appId);

  ApplicationReport appReport;
  FetchedAppReport fetchedAppReport;
  try {
    appReport = applicationsManager.
        getApplicationReport(request).getApplicationReport();
    fetchedAppReport = new FetchedAppReport(appReport, AppReportSource.RM);
  } catch (ApplicationNotFoundException e) {
    if (!isAHSEnabled) {
      // Just throw it as usual if historyService is not enabled.
      throw e;
    }
    //Fetch the application report from AHS
    appReport = historyManager.
        getApplicationReport(request).getApplicationReport();
    fetchedAppReport = new FetchedAppReport(appReport, AppReportSource.AHS);
  }
  return fetchedAppReport;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:33,代码来源:AppReportFetcher.java


示例15: testFetchReportAHSDisabled

import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException; //导入依赖的package包/类
@Test
public void testFetchReportAHSDisabled() throws YarnException, IOException {
  try {
    testHelper(false);
  } catch (ApplicationNotFoundException e) {
    Assert.assertTrue(e.getMessage() == appNotFoundExceptionMsg);
    /* RM will not know of the app and Application History Service is disabled
     * So we will not try to get the report from AHS and RM will throw
     * ApplicationNotFoundException
     */
  }
  Mockito.verify(appManager, Mockito.times(1))
  .getApplicationReport(Mockito.any(GetApplicationReportRequest.class));
  if (historyManager != null) {
    Assert.fail("HistoryManager should be null as AHS is disabled");
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:18,代码来源:TestAppReportFetcher.java


示例16: getApplicationReport

import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException; //导入依赖的package包/类
@Override
public ApplicationReport getApplicationReport(ApplicationId appId)
    throws YarnException, IOException {
  GetApplicationReportResponse response = null;
  try {
    GetApplicationReportRequest request = Records
        .newRecord(GetApplicationReportRequest.class);
    request.setApplicationId(appId);
    response = rmClient.getApplicationReport(request);
  } catch (ApplicationNotFoundException e) {
    if (!historyServiceEnabled) {
      // Just throw it as usual if historyService is not enabled.
      throw e;
    }
    return historyClient.getApplicationReport(appId);
  }
  return response.getApplicationReport();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:19,代码来源:YarnClientImpl.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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