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


Java ContainerNotFoundException类代码示例

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


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

示例1: getContainer

import org.apache.hadoop.yarn.exceptions.ContainerNotFoundException; //导入依赖的package包/类
@Override
public ContainerReport getContainer(ContainerId containerId)
    throws YarnException, IOException {
  ApplicationReportExt app = getApplication(
      containerId.getApplicationAttemptId().getApplicationId(),
      ApplicationReportField.USER_AND_ACLS);
  checkAccess(app);
  TimelineEntity entity = timelineDataManager.getEntity(
      ContainerMetricsConstants.ENTITY_TYPE,
      containerId.toString(), EnumSet.allOf(Field.class),
      UserGroupInformation.getLoginUser());
  if (entity == null) {
    throw new ContainerNotFoundException(
        "The entity for container " + containerId +
        " doesn't exist in the timeline store");
  } else {
    return convertToContainerReport(
        entity, serverHttpAddress, app.appReport.getUser());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:ApplicationHistoryManagerOnTimelineStore.java

示例2: getContainerReport

import org.apache.hadoop.yarn.exceptions.ContainerNotFoundException; //导入依赖的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

示例3: getContainer

import org.apache.hadoop.yarn.exceptions.ContainerNotFoundException; //导入依赖的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

示例4: rewrapAndThrowThrowable

import org.apache.hadoop.yarn.exceptions.ContainerNotFoundException; //导入依赖的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

示例5: getContainerReport

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

示例6: createApplicationAttemptTable

import org.apache.hadoop.yarn.exceptions.ContainerNotFoundException; //导入依赖的package包/类
protected void createApplicationAttemptTable(Block html,
    Collection<ApplicationAttemptReport> attempts) {
  TBODY<TABLE<Hamlet>> tbody =
      html.table("#attempts").thead().tr().th(".id", "Attempt ID")
        .th(".started", "Started").th(".node", "Node").th(".logs", "Logs")
        ._()._().tbody();

  StringBuilder attemptsTableData = new StringBuilder("[\n");
  for (final ApplicationAttemptReport appAttemptReport : attempts) {
    AppAttemptInfo appAttempt = new AppAttemptInfo(appAttemptReport);
    ContainerReport containerReport = null;
    try {
      final GetContainerReportRequest request =
              GetContainerReportRequest.newInstance(
                    appAttemptReport.getAMContainerId());
      if (callerUGI == null) {
        containerReport =
            appBaseProt.getContainerReport(request).getContainerReport();
      } else {
        containerReport = callerUGI.doAs(
            new PrivilegedExceptionAction<ContainerReport> () {
          @Override
          public ContainerReport run() throws Exception {
            ContainerReport report = null;
            try {
              report = appBaseProt.getContainerReport(request)
                  .getContainerReport();
            } catch (ContainerNotFoundException ex) {
              LOG.warn(ex.getMessage());
            }
            return report;
          }
        });
      }
    } catch (Exception e) {
      String message =
          "Failed to read the AM container of the application attempt "
              + appAttemptReport.getApplicationAttemptId() + ".";
      LOG.error(message, e);
      html.p()._(message)._();
      return;
    }
    long startTime = 0L;
    String logsLink = null;
    String nodeLink = null;
    if (containerReport != null) {
      ContainerInfo container = new ContainerInfo(containerReport);
      startTime = container.getStartedTime();
      logsLink = containerReport.getLogUrl();
      nodeLink = containerReport.getNodeHttpAddress();
    }
    attemptsTableData
      .append("[\"<a href='")
      .append(url("appattempt", appAttempt.getAppAttemptId()))
      .append("'>")
      .append(appAttempt.getAppAttemptId())
      .append("</a>\",\"")
      .append(startTime)
      .append("\",\"<a ")
      .append(nodeLink == null ? "#" : "href='" + nodeLink)
      .append("'>")
      .append(nodeLink == null ? "N/A" : StringEscapeUtils
          .escapeJavaScript(StringEscapeUtils.escapeHtml(nodeLink)))
      .append("</a>\",\"<a ")
      .append(logsLink == null ? "#" : "href='" + logsLink).append("'>")
      .append(logsLink == null ? "N/A" : "Logs").append("</a>\"],\n");
  }
  if (attemptsTableData.charAt(attemptsTableData.length() - 2) == ',') {
    attemptsTableData.delete(attemptsTableData.length() - 2,
      attemptsTableData.length() - 1);
  }
  attemptsTableData.append("]");
  html.script().$type("text/javascript")
    ._("var attemptsTableData=" + attemptsTableData)._();

  tbody._()._();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:78,代码来源:AppBlock.java

示例7: getContainerReport

import org.apache.hadoop.yarn.exceptions.ContainerNotFoundException; //导入依赖的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

示例8: testGetContainerReportException

import org.apache.hadoop.yarn.exceptions.ContainerNotFoundException; //导入依赖的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

示例9: generateApplicationTable

import org.apache.hadoop.yarn.exceptions.ContainerNotFoundException; //导入依赖的package包/类
protected void generateApplicationTable(Block html,
    UserGroupInformation callerUGI,
    Collection<ApplicationAttemptReport> attempts) {
  // Application Attempt Table
  TBODY<TABLE<Hamlet>> tbody =
      html.table("#attempts").thead().tr().th(".id", "Attempt ID")
        .th(".started", "Started").th(".node", "Node").th(".logs", "Logs")
        ._()._().tbody();

  StringBuilder attemptsTableData = new StringBuilder("[\n");
  for (final ApplicationAttemptReport appAttemptReport : attempts) {
    AppAttemptInfo appAttempt = new AppAttemptInfo(appAttemptReport);
    ContainerReport containerReport;
    try {
      final GetContainerReportRequest request =
              GetContainerReportRequest.newInstance(
                    appAttemptReport.getAMContainerId());
      if (callerUGI == null) {
        containerReport =
            appBaseProt.getContainerReport(request).getContainerReport();
      } else {
        containerReport = callerUGI.doAs(
            new PrivilegedExceptionAction<ContainerReport>() {
          @Override
          public ContainerReport run() throws Exception {
            ContainerReport report = null;
            if (request.getContainerId() != null) {
                try {
                  report = appBaseProt.getContainerReport(request)
                      .getContainerReport();
                } catch (ContainerNotFoundException ex) {
                  LOG.warn(ex.getMessage());
                }
            }
            return report;
          }
        });
      }
    } catch (Exception e) {
      String message =
          "Failed to read the AM container of the application attempt "
              + appAttemptReport.getApplicationAttemptId() + ".";
      LOG.error(message, e);
      html.p()._(message)._();
      return;
    }
    long startTime = 0L;
    String logsLink = null;
    String nodeLink = null;
    if (containerReport != null) {
      ContainerInfo container = new ContainerInfo(containerReport);
      startTime = container.getStartedTime();
      logsLink = containerReport.getLogUrl();
      nodeLink = containerReport.getNodeHttpAddress();
    }
    attemptsTableData
      .append("[\"<a href='")
      .append(url("appattempt", appAttempt.getAppAttemptId()))
      .append("'>")
      .append(appAttempt.getAppAttemptId())
      .append("</a>\",\"")
      .append(startTime)
      .append("\",\"<a ")
      .append(nodeLink == null ? "#" : "href='" + nodeLink)
      .append("'>")
      .append(nodeLink == null ? "N/A" : StringEscapeUtils
          .escapeJavaScript(StringEscapeUtils.escapeHtml(nodeLink)))
      .append("</a>\",\"<a ")
      .append(logsLink == null ? "#" : "href='" + logsLink).append("'>")
      .append(logsLink == null ? "N/A" : "Logs").append("</a>\"],\n");
  }
  if (attemptsTableData.charAt(attemptsTableData.length() - 2) == ',') {
    attemptsTableData.delete(attemptsTableData.length() - 2,
      attemptsTableData.length() - 1);
  }
  attemptsTableData.append("]");
  html.script().$type("text/javascript")
    ._("var attemptsTableData=" + attemptsTableData)._();

  tbody._()._();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:82,代码来源:AppBlock.java

示例10: createApplicationAttemptTable

import org.apache.hadoop.yarn.exceptions.ContainerNotFoundException; //导入依赖的package包/类
protected void createApplicationAttemptTable(Block html,
    Collection<ApplicationAttemptReport> attempts) {
  TBODY<TABLE<Hamlet>> tbody =
      html.table("#attempts").thead().tr().th(".id", "Attempt ID")
        .th(".started", "Started").th(".node", "Node").th(".logs", "Logs")
        ._()._().tbody();

  StringBuilder attemptsTableData = new StringBuilder("[\n");
  for (final ApplicationAttemptReport appAttemptReport : attempts) {
    AppAttemptInfo appAttempt = new AppAttemptInfo(appAttemptReport);
    ContainerReport containerReport = null;
    try {
      // AM container is always the first container of the attempt
      final GetContainerReportRequest request =
          GetContainerReportRequest.newInstance(ContainerId.newContainerId(
            appAttemptReport.getApplicationAttemptId(), 1));
      if (callerUGI == null) {
        containerReport =
            appBaseProt.getContainerReport(request).getContainerReport();
      } else {
        containerReport = callerUGI.doAs(
            new PrivilegedExceptionAction<ContainerReport> () {
          @Override
          public ContainerReport run() throws Exception {
            ContainerReport report = null;
            try {
              report = appBaseProt.getContainerReport(request)
                  .getContainerReport();
            } catch (ContainerNotFoundException ex) {
              LOG.warn(ex.getMessage());
            }
            return report;
          }
        });
      }
    } catch (Exception e) {
      String message =
          "Failed to read the AM container of the application attempt "
              + appAttemptReport.getApplicationAttemptId() + ".";
      LOG.error(message, e);
      html.p()._(message)._();
      return;
    }
    long startTime = 0L;
    String logsLink = null;
    String nodeLink = null;
    if (containerReport != null) {
      ContainerInfo container = new ContainerInfo(containerReport);
      startTime = container.getStartedTime();
      logsLink = containerReport.getLogUrl();
      nodeLink = containerReport.getNodeHttpAddress();
    }
    attemptsTableData
      .append("[\"<a href='")
      .append(url("appattempt", appAttempt.getAppAttemptId()))
      .append("'>")
      .append(appAttempt.getAppAttemptId())
      .append("</a>\",\"")
      .append(startTime)
      .append("\",\"<a ")
      .append(nodeLink == null ? "#" : "href='" + nodeLink)
      .append("'>")
      .append(nodeLink == null ? "N/A" : StringEscapeUtils
          .escapeJavaScript(StringEscapeUtils.escapeHtml(nodeLink)))
      .append("</a>\",\"<a ")
      .append(logsLink == null ? "#" : "href='" + logsLink).append("'>")
      .append(logsLink == null ? "N/A" : "Logs").append("</a>\"],\n");
  }
  if (attemptsTableData.charAt(attemptsTableData.length() - 2) == ',') {
    attemptsTableData.delete(attemptsTableData.length() - 2,
      attemptsTableData.length() - 1);
  }
  attemptsTableData.append("]");
  html.script().$type("text/javascript")
    ._("var attemptsTableData=" + attemptsTableData)._();

  tbody._()._();
}
 
开发者ID:yncxcw,项目名称:big-c,代码行数:79,代码来源:AppBlock.java

示例11: getContainerReport

import org.apache.hadoop.yarn.exceptions.ContainerNotFoundException; //导入依赖的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 "
          + appAttemptId + " Not Found in RM");
    }
    RMContainer rmConatiner = this.rmContext.getScheduler().getRMContainer(
        containerId);
    if (rmConatiner == null) {
      throw new ContainerNotFoundException("Container with id " + containerId
          + " not found");
    }
    response = GetContainerReportResponse.newInstance(rmConatiner
        .createContainerReport());
  } else {
    throw new YarnException("User " + callerUGI.getShortUserName()
        + " does not have privilage to see this aplication " + appId);
  }
  return response;
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:44,代码来源:ClientRMService.java

示例12: getContainerReport

import org.apache.hadoop.yarn.exceptions.ContainerNotFoundException; //导入依赖的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 application " + appId);
  }
  return response;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:45,代码来源:ClientRMService.java


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