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


Java SchedulerUtils.validateResourceRequest方法代码示例

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


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

示例1: validateResourceRequest

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerUtils; //导入方法依赖的package包/类
private void validateResourceRequest(
    ApplicationSubmissionContext submissionContext)
    throws InvalidResourceRequestException {
  // Validation of the ApplicationSubmissionContext needs to be completed
  // here. Only those fields that are dependent on RM's configuration are
  // checked here as they have to be validated whether they are part of new
  // submission or just being recovered.

  // Check whether AM resource requirements are within required limits
  if (!submissionContext.getUnmanagedAM()) {
    ResourceRequest amReq = BuilderUtils.newResourceRequest(
        RMAppAttemptImpl.AM_CONTAINER_PRIORITY, ResourceRequest.ANY,
        submissionContext.getResource(), 1);
    try {
      SchedulerUtils.validateResourceRequest(amReq,
          scheduler.getMaximumResourceCapability());
    } catch (InvalidResourceRequestException e) {
      LOG.warn("RM app submission failed in validating AM resource request"
          + " for application " + submissionContext.getApplicationId(), e);
      throw e;
    }
  }
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:24,代码来源:RMAppManager.java

示例2: validateResourceRequests

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerUtils; //导入方法依赖的package包/类
/**
 * Utility method to validate a list resource requests, by insuring that the
 * requested memory/vcore is non-negative and not greater than max
 */
public static void validateResourceRequests(List<ResourceRequest> ask,
    Resource maximumResource, String queueName, YarnScheduler scheduler)
    throws InvalidResourceRequestException {
  for (ResourceRequest resReq : ask) {
    SchedulerUtils.validateResourceRequest(resReq, maximumResource,
        queueName, scheduler);
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:13,代码来源:RMServerUtils.java

示例3: validateResourceRequests

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerUtils; //导入方法依赖的package包/类
/**
 * Utility method to validate a list resource requests, by insuring that the
 * requested memory/vcore is non-negative and not greater than max
 */
public static void validateResourceRequests(List<ResourceRequest> ask,
    Resource maximumResource) throws InvalidResourceRequestException {
  for (ResourceRequest resReq : ask) {
    SchedulerUtils.validateResourceRequest(resReq, maximumResource);
  }
}
 
开发者ID:chendave,项目名称:hadoop-TCP,代码行数:11,代码来源:RMServerUtils.java

示例4: validateAndCreateResourceRequest

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerUtils; //导入方法依赖的package包/类
private ResourceRequest validateAndCreateResourceRequest(
    ApplicationSubmissionContext submissionContext)
    throws InvalidResourceRequestException {
  // Validation of the ApplicationSubmissionContext needs to be completed
  // here. Only those fields that are dependent on RM's configuration are
  // checked here as they have to be validated whether they are part of new
  // submission or just being recovered.

  // Check whether AM resource requirements are within required limits
  if (!submissionContext.getUnmanagedAM()) {
    ResourceRequest amReq;
    if (submissionContext.getAMContainerResourceRequest() != null) {
      amReq = submissionContext.getAMContainerResourceRequest();
    } else {
      amReq =
          BuilderUtils.newResourceRequest(
              RMAppAttemptImpl.AM_CONTAINER_PRIORITY, ResourceRequest.ANY,
              submissionContext.getResource(), 1);
    }
    
    // set label expression for AM container
    if (null == amReq.getNodeLabelExpression()) {
      amReq.setNodeLabelExpression(submissionContext
          .getNodeLabelExpression());
    }

    try {
      SchedulerUtils.validateResourceRequest(amReq,
          scheduler.getMaximumResourceCapability(),
          submissionContext.getQueue(), scheduler);
    } catch (InvalidResourceRequestException e) {
      LOG.warn("RM app submission failed in validating AM resource request"
          + " for application " + submissionContext.getApplicationId(), e);
      throw e;
    }
    
    return amReq;
  }
  
  return null;
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:42,代码来源:RMAppManager.java

示例5: submitApplication

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerUtils; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected void submitApplication(
    ApplicationSubmissionContext submissionContext, long submitTime,
    boolean isRecovered, String user) throws YarnException {
  ApplicationId applicationId = submissionContext.getApplicationId();

  // Validation of the ApplicationSubmissionContext needs to be completed
  // here. Only those fields that are dependent on RM's configuration are
  // checked here as they have to be validated whether they are part of new
  // submission or just being recovered.

  // Check whether AM resource requirements are within required limits
  if (!submissionContext.getUnmanagedAM()) {
    ResourceRequest amReq = BuilderUtils.newResourceRequest(
        RMAppAttemptImpl.AM_CONTAINER_PRIORITY, ResourceRequest.ANY,
        submissionContext.getResource(), 1);
    try {
      SchedulerUtils.validateResourceRequest(amReq,
          scheduler.getMaximumResourceCapability());
    } catch (InvalidResourceRequestException e) {
      LOG.warn("RM app submission failed in validating AM resource request"
          + " for application " + applicationId, e);
      throw e;
    }
  }

  // Create RMApp
  RMApp application =
      new RMAppImpl(applicationId, rmContext, this.conf,
          submissionContext.getApplicationName(), user,
          submissionContext.getQueue(),
          submissionContext, this.scheduler, this.masterService,
          submitTime, submissionContext.getApplicationType());

  // Concurrent app submissions with same applicationId will fail here
  // Concurrent app submissions with different applicationIds will not
  // influence each other
  if (rmContext.getRMApps().putIfAbsent(applicationId, application) !=
      null) {
    String message = "Application with id " + applicationId
        + " is already present! Cannot add a duplicate!";
    LOG.warn(message);
    throw RPCUtil.getRemoteException(message);
  }

  // Inform the ACLs Manager
  this.applicationACLsManager.addApplication(applicationId,
      submissionContext.getAMContainerSpec().getApplicationACLs());

  try {
    // Setup tokens for renewal
    if (UserGroupInformation.isSecurityEnabled()) {
      this.rmContext.getDelegationTokenRenewer().addApplication(
          applicationId,parseCredentials(submissionContext),
          submissionContext.getCancelTokensWhenComplete()
          );
    }
  } catch (IOException ie) {
    LOG.warn(
        "Unable to add the application to the delegation token renewer.",
        ie);
    // Sending APP_REJECTED is fine, since we assume that the
    // RMApp is in NEW state and thus we havne't yet informed the
    // Scheduler about the existence of the application
    this.rmContext.getDispatcher().getEventHandler().handle(
        new RMAppRejectedEvent(applicationId, ie.getMessage()));
    throw RPCUtil.getRemoteException(ie);
  }

  // All done, start the RMApp
  this.rmContext.getDispatcher().getEventHandler().handle(
      new RMAppEvent(applicationId, isRecovered ? RMAppEventType.RECOVER:
          RMAppEventType.START));
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:75,代码来源:RMAppManager.java


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