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

Java ApplicationAttemptNotFoundException类代码示例

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

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



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

示例1: getApplicationAttempt

import org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException; //导入依赖的package包/类
private ApplicationAttemptReport getApplicationAttempt(
    ApplicationAttemptId appAttemptId, boolean checkACLs)
    throws YarnException, IOException {
  if (checkACLs) {
    ApplicationReportExt app = getApplication(
        appAttemptId.getApplicationId(),
        ApplicationReportField.USER_AND_ACLS);
    checkAccess(app);
  }
  TimelineEntity entity = timelineDataManager.getEntity(
      AppAttemptMetricsConstants.ENTITY_TYPE,
      appAttemptId.toString(), EnumSet.allOf(Field.class),
      UserGroupInformation.getLoginUser());
  if (entity == null) {
    throw new ApplicationAttemptNotFoundException(
        "The entity for application attempt " + appAttemptId +
        " doesn't exist in the timeline store");
  } else {
    return convertToApplicationAttemptReport(entity);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:ApplicationHistoryManagerOnTimelineStore.java


示例2: testAMRMClientAsyncShutDown

import org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException; //导入依赖的package包/类
@Test (timeout = 10000)
public void testAMRMClientAsyncShutDown() throws Exception {
  Configuration conf = new Configuration();
  TestCallbackHandler callbackHandler = new TestCallbackHandler();
  @SuppressWarnings("unchecked")
  AMRMClient<ContainerRequest> client = mock(AMRMClientImpl.class);

  createAllocateResponse(new ArrayList<ContainerStatus>(),
    new ArrayList<Container>(), null);
  when(client.allocate(anyFloat())).thenThrow(
    new ApplicationAttemptNotFoundException("app not found, shut down"));

  AMRMClientAsync<ContainerRequest> asyncClient =
      AMRMClientAsync.createAMRMClientAsync(client, 10, callbackHandler);
  asyncClient.init(conf);
  asyncClient.start();

  asyncClient.registerApplicationMaster("localhost", 1234, null);

  Thread.sleep(50);

  verify(client, times(1)).allocate(anyFloat());
  asyncClient.stop();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:TestAMRMClientAsync.java


示例3: rewrapAndThrowThrowable

import org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException; //导入依赖的package包/类
private static void rewrapAndThrowThrowable(Throwable t) {
  if (t instanceof AuthorizationException) {
    throw new ForbiddenException(t);
  } else if (t instanceof ApplicationNotFoundException ||
      t instanceof ApplicationAttemptNotFoundException ||
      t instanceof ContainerNotFoundException) {
    throw new NotFoundException(t);
  } else {
    throw new WebApplicationException(t);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:WebServices.java


示例4: testAMRMClientAsyncShutDownWithWaitFor

import org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException; //导入依赖的package包/类
@Test (timeout = 10000)
public void testAMRMClientAsyncShutDownWithWaitFor() throws Exception {
  Configuration conf = new Configuration();
  final TestCallbackHandler callbackHandler = new TestCallbackHandler();
  @SuppressWarnings("unchecked")
  AMRMClient<ContainerRequest> client = mock(AMRMClientImpl.class);
  when(client.allocate(anyFloat())).thenThrow(
    new ApplicationAttemptNotFoundException("app not found, shut down"));

  AMRMClientAsync<ContainerRequest> asyncClient =
      AMRMClientAsync.createAMRMClientAsync(client, 10, callbackHandler);
  asyncClient.init(conf);
  asyncClient.start();

  Supplier<Boolean> checker = new Supplier<Boolean>() {
    @Override
    public Boolean get() {
      return callbackHandler.reboot;
    }
  };

  asyncClient.registerApplicationMaster("localhost", 1234, null);
  asyncClient.waitFor(checker);

  asyncClient.stop();
  // stopping should have joined all threads and completed all callbacks
  Assert.assertTrue(callbackHandler.callbackCount == 0);

  verify(client, times(1)).allocate(anyFloat());
  asyncClient.stop();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:32,代码来源:TestAMRMClientAsync.java


示例5: testGetApplicationAttemptReportException

import org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException; //导入依赖的package包/类
@Test
public void testGetApplicationAttemptReportException() throws Exception {
  ApplicationCLI cli = createAndGetAppCLI();
  ApplicationId applicationId = ApplicationId.newInstance(1234, 5);
  ApplicationAttemptId attemptId1 = ApplicationAttemptId.newInstance(
      applicationId, 1);
  when(client.getApplicationAttemptReport(attemptId1)).thenThrow(
      new ApplicationNotFoundException("History file for application"
          + applicationId + " is not found"));

  int exitCode = cli.run(new String[] { "applicationattempt", "-status",
      attemptId1.toString() });
  verify(sysOut).println(
      "Application for AppAttempt with id '" + attemptId1
          + "' doesn't exist in RM or Timeline Server.");
  Assert.assertNotSame("should return non-zero exit code.", 0, exitCode);

  ApplicationAttemptId attemptId2 = ApplicationAttemptId.newInstance(
      applicationId, 2);
  when(client.getApplicationAttemptReport(attemptId2)).thenThrow(
      new ApplicationAttemptNotFoundException(
          "History file for application attempt" + attemptId2
              + " is not found"));

  exitCode = cli.run(new String[] { "applicationattempt", "-status",
      attemptId2.toString() });
  verify(sysOut).println(
      "Application Attempt with id '" + attemptId2
          + "' doesn't exist in RM or Timeline Server.");
  Assert.assertNotSame("should return non-zero exit code.", 0, exitCode);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:32,代码来源:TestYarnCLI.java


示例6: getApplicationAttemptReport

import org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException; //导入依赖的package包/类
@Override
public GetApplicationAttemptReportResponse getApplicationAttemptReport(
    GetApplicationAttemptReportRequest request) throws YarnException,
    IOException {
  ApplicationAttemptId appAttemptId = request.getApplicationAttemptId();
  UserGroupInformation callerUGI;
  try {
    callerUGI = UserGroupInformation.getCurrentUser();
  } catch (IOException ie) {
    LOG.info("Error getting UGI ", ie);
    throw RPCUtil.getRemoteException(ie);
  }
  RMApp application = this.rmContext.getRMApps().get(
      appAttemptId.getApplicationId());
  if (application == null) {
    // If the RM doesn't have the application, throw
    // ApplicationNotFoundException and let client to handle.
    throw new ApplicationNotFoundException("Application with id '"
        + request.getApplicationAttemptId().getApplicationId()
        + "' doesn't exist in RM.");
  }

  boolean allowAccess = checkAccess(callerUGI, application.getUser(),
      ApplicationAccessType.VIEW_APP, application);
  GetApplicationAttemptReportResponse response = null;
  if (allowAccess) {
    RMAppAttempt appAttempt = application.getAppAttempts().get(appAttemptId);
    if (appAttempt == null) {
      throw new ApplicationAttemptNotFoundException("ApplicationAttempt "
          + appAttemptId + " Not Found in RM");
    }
    ApplicationAttemptReport attemptReport = appAttempt
        .createApplicationAttemptReport();
    response = GetApplicationAttemptReportResponse.newInstance(attemptReport);
  }else{
    throw new YarnException("User " + callerUGI.getShortUserName()
        + " does not have privilage to see this attempt " + appAttemptId);
  }
  return response;
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:41,代码来源:ClientRMService.java


示例7: getApplicationAttemptReport

import org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException; //导入依赖的package包/类
@Override
public GetApplicationAttemptReportResponse getApplicationAttemptReport(
    GetApplicationAttemptReportRequest request) throws YarnException,
    IOException {
  try {
    GetApplicationAttemptReportResponse response =
        GetApplicationAttemptReportResponse.newInstance(history
          .getApplicationAttempt(request.getApplicationAttemptId()));
    return response;
  } catch (IOException e) {
    throw new ApplicationAttemptNotFoundException(e.getMessage());
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:14,代码来源:ApplicationHistoryClientService.java


示例8: getApplicationAttemptReport

import org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException; //导入依赖的package包/类
@Override
public GetApplicationAttemptReportResponse getApplicationAttemptReport(
    GetApplicationAttemptReportRequest request) throws YarnException,
    IOException {
  ApplicationAttemptId appAttemptId = request.getApplicationAttemptId();
  UserGroupInformation callerUGI;
  try {
    callerUGI = UserGroupInformation.getCurrentUser();
  } catch (IOException ie) {
    LOG.info("Error getting UGI ", ie);
    throw RPCUtil.getRemoteException(ie);
  }
  RMApp application = this.rmContext.getRMApps().get(
      appAttemptId.getApplicationId());
  if (application == null) {
    // If the RM doesn't have the application, throw
    // ApplicationNotFoundException and let client to handle.
    throw new ApplicationNotFoundException("Application with id '"
        + request.getApplicationAttemptId().getApplicationId()
        + "' doesn't exist in RM.");
  }

  boolean allowAccess = checkAccess(callerUGI, application.getUser(),
      ApplicationAccessType.VIEW_APP, application);
  GetApplicationAttemptReportResponse response = null;
  if (allowAccess) {
    RMAppAttempt appAttempt = application.getAppAttempts().get(appAttemptId);
    if (appAttempt == null) {
      throw new ApplicationAttemptNotFoundException(
          "ApplicationAttempt with id '" + appAttemptId +
          "' doesn't exist in RM.");
    }
    ApplicationAttemptReport attemptReport = appAttempt
        .createApplicationAttemptReport();
    response = GetApplicationAttemptReportResponse.newInstance(attemptReport);
  }else{
    throw new YarnException("User " + callerUGI.getShortUserName()
        + " does not have privilage to see this attempt " + appAttemptId);
  }
  return response;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:42,代码来源:ClientRMService.java


示例9: getContainerReport

import org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException; //导入依赖的package包/类
@Override
public GetContainerReportResponse getContainerReport(
    GetContainerReportRequest request) throws YarnException, IOException {
  ContainerId containerId = request.getContainerId();
  ApplicationAttemptId appAttemptId = containerId.getApplicationAttemptId();
  ApplicationId appId = appAttemptId.getApplicationId();
  UserGroupInformation callerUGI;
  try {
    callerUGI = UserGroupInformation.getCurrentUser();
  } catch (IOException ie) {
    LOG.info("Error getting UGI ", ie);
    throw RPCUtil.getRemoteException(ie);
  }
  RMApp application = this.rmContext.getRMApps().get(appId);
  if (application == null) {
    // If the RM doesn't have the application, throw
    // ApplicationNotFoundException and let client to handle.
    throw new ApplicationNotFoundException("Application with id '" + appId
        + "' doesn't exist in RM.");
  }
  boolean allowAccess = checkAccess(callerUGI, application.getUser(),
      ApplicationAccessType.VIEW_APP, application);
  GetContainerReportResponse response = null;
  if (allowAccess) {
    RMAppAttempt appAttempt = application.getAppAttempts().get(appAttemptId);
    if (appAttempt == null) {
      throw new ApplicationAttemptNotFoundException(
          "ApplicationAttempt with id '" + appAttemptId +
          "' doesn't exist in RM.");
    }
    RMContainer rmConatiner = this.rmContext.getScheduler().getRMContainer(
        containerId);
    if (rmConatiner == null) {
      throw new ContainerNotFoundException("Container with id '" + containerId
          + "' doesn't exist in RM.");
    }
    response = GetContainerReportResponse.newInstance(rmConatiner
        .createContainerReport());
  } else {
    throw new YarnException("User " + callerUGI.getShortUserName()
        + " does not have privilage to see this aplication " + appId);
  }
  return response;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:45,代码来源:ClientRMService.java


示例10: getContainers

import org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException; //导入依赖的package包/类
@Override
public GetContainersResponse getContainers(GetContainersRequest request)
    throws YarnException, IOException {
  ApplicationAttemptId appAttemptId = request.getApplicationAttemptId();
  ApplicationId appId = appAttemptId.getApplicationId();
  UserGroupInformation callerUGI;
  try {
    callerUGI = UserGroupInformation.getCurrentUser();
  } catch (IOException ie) {
    LOG.info("Error getting UGI ", ie);
    throw RPCUtil.getRemoteException(ie);
  }
  RMApp application = this.rmContext.getRMApps().get(appId);
  if (application == null) {
    // If the RM doesn't have the application, throw
    // ApplicationNotFoundException and let client to handle.
    throw new ApplicationNotFoundException("Application with id '" + appId
        + "' doesn't exist in RM.");
  }
  boolean allowAccess = checkAccess(callerUGI, application.getUser(),
      ApplicationAccessType.VIEW_APP, application);
  GetContainersResponse response = null;
  if (allowAccess) {
    RMAppAttempt appAttempt = application.getAppAttempts().get(appAttemptId);
    if (appAttempt == null) {
      throw new ApplicationAttemptNotFoundException(
          "ApplicationAttempt with id '" + appAttemptId +
          "' doesn't exist in RM.");
    }
    Collection<RMContainer> rmContainers = Collections.emptyList();
    SchedulerAppReport schedulerAppReport =
        this.rmContext.getScheduler().getSchedulerAppInfo(appAttemptId);
    if (schedulerAppReport != null) {
      rmContainers = schedulerAppReport.getLiveContainers();
    }
    List<ContainerReport> listContainers = new ArrayList<ContainerReport>();
    for (RMContainer rmContainer : rmContainers) {
      listContainers.add(rmContainer.createContainerReport());
    }
    response = GetContainersResponse.newInstance(listContainers);
  } else {
    throw new YarnException("User " + callerUGI.getShortUserName()
        + " does not have privilage to see this aplication " + appId);
  }
  return response;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:47,代码来源:ClientRMService.java


示例11: generateApplicationReport

import org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException; //导入依赖的package包/类
private ApplicationReportExt generateApplicationReport(TimelineEntity entity,
    ApplicationReportField field) throws YarnException, IOException {
  ApplicationReportExt app = convertToApplicationReport(entity, field);
  // If only user and acls are pulled to check attempt(s)/container(s) access
  // control, we can return immediately
  if (field == ApplicationReportField.USER_AND_ACLS) {
    return app;
  }
  try {
    checkAccess(app);
    if (app.appReport.getCurrentApplicationAttemptId() != null) {
      ApplicationAttemptReport appAttempt = getApplicationAttempt(
          app.appReport.getCurrentApplicationAttemptId(), false);
      app.appReport.setHost(appAttempt.getHost());
      app.appReport.setRpcPort(appAttempt.getRpcPort());
      app.appReport.setTrackingUrl(appAttempt.getTrackingUrl());
      app.appReport.setOriginalTrackingUrl(appAttempt.getOriginalTrackingUrl());
    }
  } catch (AuthorizationException | ApplicationAttemptNotFoundException e) {
    // AuthorizationException is thrown because the user doesn't have access
    // It's possible that the app is finished before the first attempt is created.
    app.appReport.setDiagnostics(null);
    app.appReport.setCurrentApplicationAttemptId(null);
  }
  if (app.appReport.getCurrentApplicationAttemptId() == null) {
    app.appReport.setCurrentApplicationAttemptId(
        ApplicationAttemptId.newInstance(app.appReport.getApplicationId(), -1));
  }
  if (app.appReport.getHost() == null) {
    app.appReport.setHost(UNAVAILABLE);
  }
  if (app.appReport.getRpcPort() < 0) {
    app.appReport.setRpcPort(-1);
  }
  if (app.appReport.getTrackingUrl() == null) {
    app.appReport.setTrackingUrl(UNAVAILABLE);
  }
  if (app.appReport.getOriginalTrackingUrl() == null) {
    app.appReport.setOriginalTrackingUrl(UNAVAILABLE);
  }
  if (app.appReport.getDiagnostics() == null) {
    app.appReport.setDiagnostics("");
  }
  return app;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:46,代码来源:ApplicationHistoryManagerOnTimelineStore.java


示例12: testGetContainerReportException

import org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException; //导入依赖的package包/类
@Test
public void testGetContainerReportException() throws Exception {
  ApplicationCLI cli = createAndGetAppCLI();
  ApplicationId applicationId = ApplicationId.newInstance(1234, 5);
  ApplicationAttemptId attemptId = ApplicationAttemptId.newInstance(
      applicationId, 1);
  long cntId = 1;
  ContainerId containerId1 = ContainerId.newContainerId(attemptId, cntId++);
  when(client.getContainerReport(containerId1)).thenThrow(
      new ApplicationNotFoundException("History file for application"
          + applicationId + " is not found"));

  int exitCode = cli.run(new String[] { "container", "-status",
      containerId1.toString() });
  verify(sysOut).println(
      "Application for Container with id '" + containerId1
          + "' doesn't exist in RM or Timeline Server.");
  Assert.assertNotSame("should return non-zero exit code.", 0, exitCode);
  ContainerId containerId2 = ContainerId.newContainerId(attemptId, cntId++);
  when(client.getContainerReport(containerId2)).thenThrow(
      new ApplicationAttemptNotFoundException(
          "History file for application attempt" + attemptId
              + " is not found"));

  exitCode = cli.run(new String[] { "container", "-status",
      containerId2.toString() });
  verify(sysOut).println(
      "Application Attempt for Container with id '" + containerId2
          + "' doesn't exist in RM or Timeline Server.");
  Assert.assertNotSame("should return non-zero exit code.", 0, exitCode);

  ContainerId containerId3 = ContainerId.newContainerId(attemptId, cntId++);
  when(client.getContainerReport(containerId3)).thenThrow(
      new ContainerNotFoundException("History file for container"
          + containerId3 + " is not found"));
  exitCode = cli.run(new String[] { "container", "-status",
      containerId3.toString() });
  verify(sysOut).println(
      "Container with id '" + containerId3
          + "' doesn't exist in RM or Timeline Server.");
  Assert.assertNotSame("should return non-zero exit code.", 0, exitCode);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:43,代码来源:TestYarnCLI.java


示例13: failApplicationAttempt

import org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public FailApplicationAttemptResponse failApplicationAttempt(
    FailApplicationAttemptRequest request) throws YarnException {

  ApplicationAttemptId attemptId = request.getApplicationAttemptId();
  ApplicationId applicationId = attemptId.getApplicationId();

  UserGroupInformation callerUGI;
  try {
    callerUGI = UserGroupInformation.getCurrentUser();
  } catch (IOException ie) {
    LOG.info("Error getting UGI ", ie);
    RMAuditLogger.logFailure("UNKNOWN", AuditConstants.FAIL_ATTEMPT_REQUEST,
        "UNKNOWN", "ClientRMService" , "Error getting UGI",
        applicationId, attemptId);
    throw RPCUtil.getRemoteException(ie);
  }

  RMApp application = this.rmContext.getRMApps().get(applicationId);
  if (application == null) {
    RMAuditLogger.logFailure(callerUGI.getUserName(),
        AuditConstants.FAIL_ATTEMPT_REQUEST, "UNKNOWN", "ClientRMService",
        "Trying to fail an attempt of an absent application", applicationId,
        attemptId);
    throw new ApplicationNotFoundException("Trying to fail an attempt "
        + attemptId + " of an absent application " + applicationId);
  }

  RMAppAttempt appAttempt = application.getAppAttempts().get(attemptId);
  if (appAttempt == null) {
    throw new ApplicationAttemptNotFoundException(
        "ApplicationAttempt with id '" + attemptId + "' doesn't exist in RM.");
  }

  if (!checkAccess(callerUGI, application.getUser(),
      ApplicationAccessType.MODIFY_APP, application)) {
    RMAuditLogger.logFailure(callerUGI.getShortUserName(),
        AuditConstants.FAIL_ATTEMPT_REQUEST,
        "User doesn't have permissions to "
            + ApplicationAccessType.MODIFY_APP.toString(), "ClientRMService",
        AuditConstants.UNAUTHORIZED_USER, applicationId);
    throw RPCUtil.getRemoteException(new AccessControlException("User "
        + callerUGI.getShortUserName() + " cannot perform operation "
        + ApplicationAccessType.MODIFY_APP.name() + " on " + applicationId));
  }

  FailApplicationAttemptResponse response =
      recordFactory.newRecordInstance(FailApplicationAttemptResponse.class);

  if (!ACTIVE_APP_STATES.contains(application.getState())) {
    if (COMPLETED_APP_STATES.contains(application.getState())) {
      RMAuditLogger.logSuccess(callerUGI.getShortUserName(),
          AuditConstants.FAIL_ATTEMPT_REQUEST, "ClientRMService",
          applicationId);
      return response;
    }
  }

  this.rmContext.getDispatcher().getEventHandler().handle(
      new RMAppAttemptEvent(attemptId, RMAppAttemptEventType.FAIL,
      "Attempt failed by user."));

  RMAuditLogger.logSuccess(callerUGI.getShortUserName(),
      AuditConstants.FAIL_ATTEMPT_REQUEST, "ClientRMService", applicationId,
      attemptId);

  return response;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:70,代码来源:ClientRMService.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java ValidationResult类代码示例发布时间:2022-05-22
下一篇:
Java MobEffectPacket类代码示例发布时间: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