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


Java Allocation类代码示例

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


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

示例1: getAllocation

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Allocation; //导入依赖的package包/类
/**
 * This method produces an Allocation that includes the current view
 * of the resources that will be allocated to and preempted from this
 * application.
 *
 * @param rc
 * @param clusterResource
 * @param minimumAllocation
 * @return an allocation
 */
public synchronized Allocation getAllocation(ResourceCalculator rc,
    Resource clusterResource, Resource minimumAllocation) {

  Set<ContainerId> currentContPreemption = Collections.unmodifiableSet(
      new HashSet<ContainerId>(containersToPreempt));
  containersToPreempt.clear();
  Resource tot = Resource.newInstance(0, 0, 0);
  for(ContainerId c : currentContPreemption){
    Resources.addTo(tot,
        liveContainers.get(c).getContainer().getResource());
  }
  int numCont = (int) Math.ceil(
      Resources.divide(rc, clusterResource, tot, minimumAllocation));
  ResourceRequest rr = ResourceRequest.newInstance(
      Priority.UNDEFINED, ResourceRequest.ANY,
      minimumAllocation, numCont);
  ContainersAndNMTokensAllocation allocation =
      pullNewlyAllocatedContainersAndNMTokens();
  Resource headroom = getHeadroom();
  setApplicationHeadroomForMetrics(headroom);
  return new Allocation(allocation.getContainerList(), headroom, null,
    currentContPreemption, Collections.singletonList(rr),
    allocation.getNMTokenList());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:35,代码来源:FiCaSchedulerApp.java

示例2: allocate

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Allocation; //导入依赖的package包/类
@Override
public synchronized Allocation allocate(
    ApplicationAttemptId applicationAttemptId, List<ResourceRequest> ask,
    List<ContainerId> release, List<String> blacklistAdditions,
    List<String> blacklistRemovals) {
  List<ResourceRequest> askCopy = new ArrayList<ResourceRequest>();
  for (ResourceRequest req : ask) {
    ResourceRequest reqCopy =
        ResourceRequest.newInstance(req.getPriority(),
            req.getResourceName(), req.getCapability(),
            req.getNumContainers(), req.getRelaxLocality());
    askCopy.add(reqCopy);
  }
  lastAsk = ask;
  lastRelease = release;
  lastBlacklistAdditions = blacklistAdditions;
  lastBlacklistRemovals = blacklistRemovals;
  return super.allocate(applicationAttemptId, askCopy, release,
      blacklistAdditions, blacklistRemovals);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:TestAMRMClientOnRMRestart.java

示例3: allocate

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Allocation; //导入依赖的package包/类
@Override
public synchronized Allocation allocate(
    ApplicationAttemptId applicationAttemptId, List<ResourceRequest> ask,
    List<ContainerId> release, 
    List<String> blacklistAdditions, List<String> blacklistRemovals) {
  List<ResourceRequest> askCopy = new ArrayList<ResourceRequest>();
  for (ResourceRequest req : ask) {
    ResourceRequest reqCopy = ResourceRequest.newInstance(req
        .getPriority(), req.getResourceName(), req.getCapability(), req
        .getNumContainers(), req.getRelaxLocality());
    askCopy.add(reqCopy);
  }
  SecurityUtil.setTokenServiceUseIp(false);
  lastAsk = ask;
  lastRelease = release;
  lastBlacklistAdditions = blacklistAdditions;
  lastBlacklistRemovals = blacklistRemovals;
  return super.allocate(
      applicationAttemptId, askCopy, release, 
      blacklistAdditions, blacklistRemovals);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:TestRMContainerAllocator.java

示例4: allocate

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Allocation; //导入依赖的package包/类
@Override
public synchronized Allocation allocate(
    ApplicationAttemptId applicationAttemptId, List<ResourceRequest> ask,
    List<ContainerId> release, List<String> blacklistAdditions,
    List<String> blacklistRemovals,
    List<ContainerResourceChangeRequest> increaseRequests,
    List<ContainerResourceChangeRequest> decreaseRequests) {
  List<ResourceRequest> askCopy = new ArrayList<ResourceRequest>();
  for (ResourceRequest req : ask) {
    ResourceRequest reqCopy =
        ResourceRequest.newInstance(req.getPriority(),
            req.getResourceName(), req.getCapability(),
            req.getNumContainers(), req.getRelaxLocality());
    askCopy.add(reqCopy);
  }
  lastAsk = ask;
  lastRelease = release;
  lastIncrease = increaseRequests;
  lastDecrease = decreaseRequests;
  lastBlacklistAdditions = blacklistAdditions;
  lastBlacklistRemovals = blacklistRemovals;
  return super.allocate(applicationAttemptId, askCopy, release,
      blacklistAdditions, blacklistRemovals, increaseRequests,
      decreaseRequests);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:26,代码来源:TestAMRMClientOnRMRestart.java

示例5: generatePreemptionMessage

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Allocation; //导入依赖的package包/类
private PreemptionMessage generatePreemptionMessage(
    Set<ContainerId> containerToPreempt,
    HashMap<ContainerId, Resource> resPerCont,
    Resource minimumAllocation, boolean strict) {

  Set<ContainerId> currentContPreemption = Collections.unmodifiableSet(
      new HashSet<ContainerId>(containerToPreempt));
  containerToPreempt.clear();
  Resource tot = Resource.newInstance(0, 0);
  for(ContainerId c : currentContPreemption){
    Resources.addTo(tot,
        resPerCont.get(c));
  }
  int numCont = (int) Math.ceil(tot.getMemory() /
            (double) minimumAllocation.getMemory());
  ResourceRequest rr = ResourceRequest.newInstance(
      Priority.newInstance(0), ResourceRequest.ANY,
      minimumAllocation, numCont);
  if (strict) {
    return generatePreemptionMessage(new Allocation(null, null,
                currentContPreemption, null, null));
  }
  return generatePreemptionMessage(new Allocation(null, null,
                        null, currentContPreemption,
                        Collections.singletonList(rr)));
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:27,代码来源:TestCheckpointPreemptionPolicy.java

示例6: getAllocation

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Allocation; //导入依赖的package包/类
/**
 * This method produces an Allocation that includes the current view
 * of the resources that will be allocated to and preempted from this
 * application.
 *
 * @param rc
 * @param clusterResource
 * @param minimumAllocation
 * @return an allocation
 */
public synchronized Allocation getAllocation(ResourceCalculator rc,
    Resource clusterResource, Resource minimumAllocation) {

  Set<ContainerId> currentContPreemption = Collections.unmodifiableSet(
      new HashSet<ContainerId>(containersToPreempt));
  containersToPreempt.clear();
  Resource tot = Resource.newInstance(0, 0);
  for(ContainerId c : currentContPreemption){
    Resources.addTo(tot,
        liveContainers.get(c).getContainer().getResource());
  }
  int numCont = (int) Math.ceil(
      Resources.divide(rc, clusterResource, tot, minimumAllocation));
  ResourceRequest rr = ResourceRequest.newInstance(
      Priority.UNDEFINED, ResourceRequest.ANY,
      minimumAllocation, numCont);
  ContainersAndNMTokensAllocation allocation =
      pullNewlyAllocatedContainersAndNMTokens();
  Resource headroom = getHeadroom();
  setApplicationHeadroomForMetrics(headroom);
  return new Allocation(allocation.getContainerList(), headroom, null,
    currentContPreemption, Collections.singletonList(rr),
    allocation.getNMTokenList());
}
 
开发者ID:yncxcw,项目名称:big-c,代码行数:35,代码来源:FiCaSchedulerApp.java

示例7: allocate

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Allocation; //导入依赖的package包/类
@Override
public synchronized Allocation allocate(
    ApplicationAttemptId applicationAttemptId, List<ResourceRequest> ask,
    List<ContainerId> release, 
    List<String> blacklistAdditions, List<String> blacklistRemovals) {
  List<ResourceRequest> askCopy = new ArrayList<ResourceRequest>();
  for (ResourceRequest req : ask) {
    ResourceRequest reqCopy = ResourceRequest.newInstance(req
        .getPriority(), req.getResourceName(), req.getCapability(), req
        .getNumContainers(), req.getRelaxLocality());
    askCopy.add(reqCopy);
  }
  lastAsk = ask;
  lastRelease = release;
  lastBlacklistAdditions = blacklistAdditions;
  lastBlacklistRemovals = blacklistRemovals;
  return super.allocate(
      applicationAttemptId, askCopy, release, 
      blacklistAdditions, blacklistRemovals);
}
 
开发者ID:yncxcw,项目名称:big-c,代码行数:21,代码来源:TestRMContainerAllocator.java

示例8: getAllocation

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Allocation; //导入依赖的package包/类
/**
 * This method produces an Allocation that includes the current view
 * of the resources that will be allocated to and preempted from this
 * application.
 *
 * @param rc
 * @param clusterResource
 * @param minimumAllocation
 * @return an allocation
 */
public synchronized Allocation getAllocation(ResourceCalculator rc,
    Resource clusterResource, Resource minimumAllocation) {

  Set<ContainerId> currentContPreemption = Collections.unmodifiableSet(
      new HashSet<ContainerId>(containersToPreempt));
  containersToPreempt.clear();
  Resource tot = Resource.newInstance(0, 0);
  for(ContainerId c : currentContPreemption){
    Resources.addTo(tot,
        liveContainers.get(c).getContainer().getResource());
  }
  int numCont = (int) Math.ceil(
      Resources.divide(rc, clusterResource, tot, minimumAllocation));
  ResourceRequest rr = ResourceRequest.newInstance(
      Priority.UNDEFINED, ResourceRequest.ANY,
      minimumAllocation, numCont);
  ContainersAndNMTokensAllocation allocation =
      pullNewlyAllocatedContainersAndNMTokens();
  return new Allocation(allocation.getContainerList(), getHeadroom(), null,
    currentContPreemption, Collections.singletonList(rr),
    allocation.getNMTokenList());
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:33,代码来源:FiCaSchedulerApp.java

示例9: transition

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Allocation; //导入依赖的package包/类
@Override
public void transition(RMAppAttemptImpl appAttempt,
                                                 RMAppAttemptEvent event) {
  // Acquire the AM container from the scheduler.
  Allocation amContainerAllocation = appAttempt.scheduler.allocate(
      appAttempt.applicationAttemptId, EMPTY_CONTAINER_REQUEST_LIST,
      EMPTY_CONTAINER_RELEASE_LIST, null, null);

  // Set the masterContainer
  appAttempt.setMasterContainer(amContainerAllocation.getContainers().get(
                                                                       0));
  appAttempt.getSubmissionContext().setResource(
      appAttempt.getMasterContainer().getResource());
  RMStateStore store = appAttempt.rmContext.getStateStore();
  appAttempt.storeAttempt(store);
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:17,代码来源:RMAppAttemptImpl.java

示例10: getAllocation

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Allocation; //导入依赖的package包/类
/**
 * This method produces an Allocation that includes the current view
 * of the resources that will be allocated to and preempted from this
 * application.
 *
 * @param rc
 * @param clusterResource
 * @param minimumAllocation
 * @return an allocation
 */
public synchronized Allocation getAllocation(ResourceCalculator rc,
    Resource clusterResource, Resource minimumAllocation) {

  Set<ContainerId> currentContPreemption = Collections.unmodifiableSet(
      new HashSet<ContainerId>(containersToPreempt));
  containersToPreempt.clear();
  Resource tot = Resource.newInstance(0, 0);
  for(ContainerId c : currentContPreemption){
    Resources.addTo(tot,
        liveContainers.get(c).getContainer().getResource());
  }
  int numCont = (int) Math.ceil(
      Resources.divide(rc, clusterResource, tot, minimumAllocation));
  ResourceRequest rr = ResourceRequest.newInstance(
      Priority.UNDEFINED, ResourceRequest.ANY,
      minimumAllocation, numCont);
  return new Allocation(pullNewlyAllocatedContainers(), getHeadroom(),
                        null, currentContPreemption,
                        Collections.singletonList(rr));
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:31,代码来源:FiCaSchedulerApp.java

示例11: allocate

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Allocation; //导入依赖的package包/类
@Override
public synchronized Allocation allocate(
    ApplicationAttemptId applicationAttemptId, List<ResourceRequest> ask,
    List<ContainerId> release, 
    List<String> blacklistAdditions, List<String> blacklistRemovals) {
  List<ResourceRequest> askCopy = new ArrayList<ResourceRequest>();
  for (ResourceRequest req : ask) {
    ResourceRequest reqCopy = ResourceRequest.newInstance(req
        .getPriority(), req.getResourceName(), req.getCapability(), req
        .getNumContainers(), req.getRelaxLocality());
    askCopy.add(reqCopy);
  }
  lastAsk = ask;
  return super.allocate(
      applicationAttemptId, askCopy, release, 
      blacklistAdditions, blacklistRemovals);
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:18,代码来源:TestRMContainerAllocator.java

示例12: allocate

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Allocation; //导入依赖的package包/类
@Override
public synchronized Allocation allocate(
    ApplicationAttemptId applicationAttemptId, List<ResourceRequest> ask,
    List<ContainerId> release, List<String> blacklistAdditions,
    List<String> blacklistRemovals,
    List<UpdateContainerRequest> increaseRequests,
    List<UpdateContainerRequest> decreaseRequests) {
  List<ResourceRequest> askCopy = new ArrayList<ResourceRequest>();
  for (ResourceRequest req : ask) {
    ResourceRequest reqCopy =
        ResourceRequest.newInstance(req.getPriority(),
            req.getResourceName(), req.getCapability(),
            req.getNumContainers(), req.getRelaxLocality());
    askCopy.add(reqCopy);
  }
  lastAsk = ask;
  lastRelease = release;
  lastIncrease = increaseRequests;
  lastDecrease = decreaseRequests;
  lastBlacklistAdditions = blacklistAdditions;
  lastBlacklistRemovals = blacklistRemovals;
  return super.allocate(applicationAttemptId, askCopy, release,
      blacklistAdditions, blacklistRemovals, increaseRequests,
      decreaseRequests);
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:26,代码来源:TestAMRMClientOnRMRestart.java

示例13: allocate

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Allocation; //导入依赖的package包/类
@Override
public synchronized Allocation allocate(
    ApplicationAttemptId applicationAttemptId, List<ResourceRequest> ask,
    List<ContainerId> release, 
    List<String> blacklistAdditions, List<String> blacklistRemovals) {
  List<ResourceRequest> askCopy = new ArrayList<ResourceRequest>();
  for (ResourceRequest req : ask) {
    ResourceRequest reqCopy = ResourceRequest.newInstance(req
        .getPriority(), req.getResourceName(), req.getCapability(), req
        .getNumContainers(), req.getRelaxLocality());
    askCopy.add(reqCopy);
  }
  lastAsk = ask;
  lastBlacklistAdditions = blacklistAdditions;
  lastBlacklistRemovals = blacklistRemovals;
  return super.allocate(
      applicationAttemptId, askCopy, release, 
      blacklistAdditions, blacklistRemovals);
}
 
开发者ID:chendave,项目名称:hadoop-TCP,代码行数:20,代码来源:TestRMContainerAllocator.java

示例14: transition

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Allocation; //导入依赖的package包/类
@Override
public RMAppAttemptState transition(RMAppAttemptImpl appAttempt,
    RMAppAttemptEvent event) {
  if (!appAttempt.submissionContext.getUnmanagedAM()) {
    // Request a container for the AM.
    ResourceRequest request =
        BuilderUtils.newResourceRequest(
            AM_CONTAINER_PRIORITY, ResourceRequest.ANY, appAttempt
                .getSubmissionContext().getResource(), 1);

    // SchedulerUtils.validateResourceRequests is not necessary because
    // AM resource has been checked when submission
    Allocation amContainerAllocation = appAttempt.scheduler.allocate(
        appAttempt.applicationAttemptId,
        Collections.singletonList(request), EMPTY_CONTAINER_RELEASE_LIST, null, null);
    if (amContainerAllocation != null
        && amContainerAllocation.getContainers() != null) {
      assert (amContainerAllocation.getContainers().size() == 0);
    }
    return RMAppAttemptState.SCHEDULED;
  } else {
    // save state and then go to LAUNCHED state
    appAttempt.storeAttempt();
    return RMAppAttemptState.LAUNCHED_UNMANAGED_SAVING;
  }
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:27,代码来源:RMAppAttemptImpl.java

示例15: transition

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Allocation; //导入依赖的package包/类
@Override
public RMAppAttemptState transition(RMAppAttemptImpl appAttempt,
    RMAppAttemptEvent event) {
  ApplicationSubmissionContext subCtx = appAttempt.submissionContext;
  if (!subCtx.getUnmanagedAM()) {
    // Need reset #containers before create new attempt, because this request
    // will be passed to scheduler, and scheduler will deduct the number after
    // AM container allocated
    
    // Currently, following fields are all hard code,
    // TODO: change these fields when we want to support
    // priority/resource-name/relax-locality specification for AM containers
    // allocation.
    appAttempt.amReq.setNumContainers(1);
    appAttempt.amReq.setPriority(AM_CONTAINER_PRIORITY);
    appAttempt.amReq.setResourceName(ResourceRequest.ANY);
    appAttempt.amReq.setRelaxLocality(true);
    
    // AM resource has been checked when submission
    Allocation amContainerAllocation =
        appAttempt.scheduler.allocate(appAttempt.applicationAttemptId,
            Collections.singletonList(appAttempt.amReq),
            EMPTY_CONTAINER_RELEASE_LIST, null, null);
    if (amContainerAllocation != null
        && amContainerAllocation.getContainers() != null) {
      assert (amContainerAllocation.getContainers().size() == 0);
    }
    return RMAppAttemptState.SCHEDULED;
  } else {
    // save state and then go to LAUNCHED state
    appAttempt.storeAttempt();
    return RMAppAttemptState.LAUNCHED_UNMANAGED_SAVING;
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:35,代码来源:RMAppAttemptImpl.java


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