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


Java ApplicationSubmissionContextInfo.getApplicationId方法代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ApplicationSubmissionContextInfo.getApplicationId方法的典型用法代码示例。如果您正苦于以下问题:Java ApplicationSubmissionContextInfo.getApplicationId方法的具体用法?Java ApplicationSubmissionContextInfo.getApplicationId怎么用?Java ApplicationSubmissionContextInfo.getApplicationId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ApplicationSubmissionContextInfo的用法示例。


在下文中一共展示了ApplicationSubmissionContextInfo.getApplicationId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createAppSubmissionContext

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ApplicationSubmissionContextInfo; //导入方法依赖的package包/类
/**
 * Create the actual ApplicationSubmissionContext to be submitted to the RM
 * from the information provided by the user.
 * 
 * @param newApp
 *          the information provided by the user
 * @return returns the constructed ApplicationSubmissionContext
 * @throws IOException
 */
protected ApplicationSubmissionContext createAppSubmissionContext(
    ApplicationSubmissionContextInfo newApp) throws IOException {

  // create local resources and app submission context

  ApplicationId appid;
  String error =
      "Could not parse application id " + newApp.getApplicationId();
  try {
    appid =
        ConverterUtils.toApplicationId(recordFactory,
          newApp.getApplicationId());
  } catch (Exception e) {
    throw new BadRequestException(error);
  }
  ApplicationSubmissionContext appContext =
      ApplicationSubmissionContext.newInstance(appid,
        newApp.getApplicationName(), newApp.getQueue(),
        Priority.newInstance(newApp.getPriority()),
        createContainerLaunchContext(newApp), newApp.getUnmanagedAM(),
        newApp.getCancelTokensWhenComplete(), newApp.getMaxAppAttempts(),
        createAppSubmissionContextResource(newApp),
        newApp.getApplicationType(),
        newApp.getKeepContainersAcrossApplicationAttempts(),
        newApp.getAppNodeLabelExpression(),
        newApp.getAMContainerNodeLabelExpression());
  appContext.setApplicationTags(newApp.getApplicationTags());

  return appContext;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:40,代码来源:RMWebServices.java

示例2: createAppSubmissionContext

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ApplicationSubmissionContextInfo; //导入方法依赖的package包/类
/**
 * Create the actual ApplicationSubmissionContext to be submitted to the RM
 * from the information provided by the user.
 * 
 * @param newApp
 *          the information provided by the user
 * @return returns the constructed ApplicationSubmissionContext
 * @throws IOException
 */
protected ApplicationSubmissionContext createAppSubmissionContext(
    ApplicationSubmissionContextInfo newApp) throws IOException {

  // create local resources and app submission context

  ApplicationId appid;
  String error =
      "Could not parse application id " + newApp.getApplicationId();
  try {
    appid = ApplicationId.fromString(newApp.getApplicationId());
  } catch (Exception e) {
    throw new BadRequestException(error);
  }
  ApplicationSubmissionContext appContext =
      ApplicationSubmissionContext.newInstance(appid,
        newApp.getApplicationName(), newApp.getQueue(),
        Priority.newInstance(newApp.getPriority()),
        createContainerLaunchContext(newApp), newApp.getUnmanagedAM(),
        newApp.getCancelTokensWhenComplete(), newApp.getMaxAppAttempts(),
        createAppSubmissionContextResource(newApp),
        newApp.getApplicationType(),
        newApp.getKeepContainersAcrossApplicationAttempts(),
        newApp.getAppNodeLabelExpression(),
        newApp.getAMContainerNodeLabelExpression());
  appContext.setApplicationTags(newApp.getApplicationTags());

  return appContext;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:38,代码来源:RMWebServices.java

示例3: submitApplication

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ApplicationSubmissionContextInfo; //导入方法依赖的package包/类
/**
 * Function to submit an app to the RM
 * 
 * @param newApp
 *          structure containing information to construct the
 *          ApplicationSubmissionContext
 * @param hsr
 *          the servlet request
 * @return Response containing the status code
 * @throws AuthorizationException
 * @throws IOException
 * @throws InterruptedException
 */
@POST
@Path("/apps")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response submitApplication(ApplicationSubmissionContextInfo newApp,
    @Context HttpServletRequest hsr) throws AuthorizationException,
    IOException, InterruptedException {

  init();
  UserGroupInformation callerUGI = getCallerUserGroupInformation(hsr, true);
  if (callerUGI == null) {
    throw new AuthorizationException("Unable to obtain user name, "
        + "user not authenticated");
  }

  if (UserGroupInformation.isSecurityEnabled() && isStaticUser(callerUGI)) {
    String msg = "The default static user cannot carry out this operation.";
    return Response.status(Status.FORBIDDEN).entity(msg).build();
  }

  ApplicationSubmissionContext appContext =
      createAppSubmissionContext(newApp);
  final SubmitApplicationRequest req =
      SubmitApplicationRequest.newInstance(appContext);

  try {
    callerUGI
      .doAs(new PrivilegedExceptionAction<SubmitApplicationResponse>() {
        @Override
        public SubmitApplicationResponse run() throws IOException,
            YarnException {
          return rm.getClientRMService().submitApplication(req);
        }
      });
  } catch (UndeclaredThrowableException ue) {
    if (ue.getCause() instanceof YarnException) {
      throw new BadRequestException(ue.getCause().getMessage());
    }
    LOG.info("Submit app request failed", ue);
    throw ue;
  }

  String url = hsr.getRequestURL() + "/" + newApp.getApplicationId();
  return Response.status(Status.ACCEPTED).header(HttpHeaders.LOCATION, url)
    .build();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:60,代码来源:RMWebServices.java


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