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

Java RMContainer类代码示例

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

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



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

示例1: handle

import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; //导入依赖的package包/类
@Override
public void handle(ContainerPreemptEvent event) {
  ApplicationAttemptId aid = event.getAppId();
  RMContainer container = event.getContainer();
  switch (event.getType()) {
  case DROP_RESERVATION:
    scheduler.dropContainerReservation(container);
    break;
  case PREEMPT_CONTAINER:
    scheduler.preemptContainer(aid, container);
    break;
  case KILL_CONTAINER:
    scheduler.killContainer(container);
    break;
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:ResourceManager.java


示例2: createRMContainer

import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; //导入依赖的package包/类
private static RMContainer createRMContainer(ContainerId containerId) {
  RMContainer container = mock(RMContainer.class);
  when(container.getContainerId()).thenReturn(containerId);
  when(container.getAllocatedNode()).thenReturn(
    NodeId.newInstance("test host", -100));
  when(container.getAllocatedResource()).thenReturn(
    Resource.newInstance(-1, -1, -1));
  when(container.getAllocatedPriority()).thenReturn(Priority.UNDEFINED);
  when(container.getCreationTime()).thenReturn(0L);
  when(container.getFinishTime()).thenReturn(1L);
  when(container.getDiagnosticsInfo()).thenReturn("test diagnostics info");
  when(container.getLogURL()).thenReturn("test log url");
  when(container.getContainerExitStatus()).thenReturn(-1);
  when(container.getContainerState()).thenReturn(ContainerState.COMPLETE);
  return container;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:TestRMApplicationHistoryWriter.java


示例3: recoverContainer

import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; //导入依赖的package包/类
public synchronized void recoverContainer(SchedulerNode node,
    RMContainer rmContainer) {
  // recover app scheduling info
  appSchedulingInfo.recoverContainer(rmContainer);

  if (rmContainer.getState().equals(RMContainerState.COMPLETED)) {
    return;
  }
  LOG.info("SchedulerAttempt " + getApplicationAttemptId()
    + " is recovering container " + rmContainer.getContainerId());
  liveContainers.put(rmContainer.getContainerId(), rmContainer);
  attemptResourceUsage.incUsed(node.getPartition(), rmContainer
      .getContainer().getResource());
  
  // resourceLimit: updated when LeafQueue#recoverContainer#allocateResource
  // is called.
  // newlyAllocatedContainers.add(rmContainer);
  // schedulingOpportunities
  // lastScheduledContainer
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:SchedulerApplicationAttempt.java


示例4: mockContainer

import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; //导入依赖的package包/类
RMContainer mockContainer(ApplicationAttemptId appAttId, int id,
    Resource r, int cpriority) {
  ContainerId cId = ContainerId.newContainerId(appAttId, id);
  Container c = mock(Container.class);
  when(c.getResource()).thenReturn(r);
  when(c.getPriority()).thenReturn(Priority.create(cpriority));
  RMContainer mC = mock(RMContainer.class);
  when(mC.getContainerId()).thenReturn(cId);
  when(mC.getContainer()).thenReturn(c);
  when(mC.getApplicationAttemptId()).thenReturn(appAttId);
  if (priority.AMCONTAINER.getValue() == cpriority) {
    when(mC.isAMContainer()).thenReturn(true);
  }
  if (priority.LABELEDCONTAINER.getValue() == cpriority) {
    when(mC.getAllocatedNode()).thenReturn(NodeId.newInstance("node1", 0));
  }
  return mC;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:TestProportionalCapacityPreemptionPolicy.java


示例5: unreserveInternal

import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; //导入依赖的package包/类
private synchronized void unreserveInternal(
    Priority priority, FSSchedulerNode node) {
  Map<NodeId, RMContainer> reservedContainers = 
      this.reservedContainers.get(priority);
  RMContainer reservedContainer = reservedContainers.remove(node.getNodeID());
  if (reservedContainers.isEmpty()) {
    this.reservedContainers.remove(priority);
  }
  
  // Reset the re-reservation count
  resetReReservations(priority);

  Resource resource = reservedContainer.getContainer().getResource();
  this.attemptResourceUsage.decReserved(resource);

  LOG.info("Application " + getApplicationId() + " unreserved " + " on node "
      + node + ", currently has " + reservedContainers.size()
      + " at priority " + priority + "; currentReservation "
      + this.attemptResourceUsage.getReserved());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:FSAppAttempt.java


示例6: attachContainer

import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; //导入依赖的package包/类
@Override
public void attachContainer(Resource clusterResource,
    FiCaSchedulerApp application, RMContainer rmContainer) {
  if (application != null) {
    FiCaSchedulerNode node =
        scheduler.getNode(rmContainer.getContainer().getNodeId());
    allocateResource(clusterResource, application, rmContainer.getContainer()
        .getResource(), node.getLabels());
    LOG.info("movedContainer" + " container=" + rmContainer.getContainer()
        + " resource=" + rmContainer.getContainer().getResource()
        + " queueMoveIn=" + this + " usedCapacity=" + getUsedCapacity()
        + " absoluteUsedCapacity=" + getAbsoluteUsedCapacity() + " used="
        + queueUsage.getUsed() + " cluster=" + clusterResource);
    // Inform the parent queue
    getParent().attachContainer(clusterResource, application, rmContainer);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:LeafQueue.java


示例7: assignReservedContainer

import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; //导入依赖的package包/类
/**
 * Called when this application already has an existing reservation on the
 * given node.  Sees whether we can turn the reservation into an allocation.
 * Also checks whether the application needs the reservation anymore, and
 * releases it if not.
 *
 * @param node
 *     Node that the application has an existing reservation on
 */
public Resource assignReservedContainer(FSSchedulerNode node) {
  RMContainer rmContainer = node.getReservedContainer();
  Priority priority = rmContainer.getReservedPriority();

  // Make sure the application still needs requests at this priority
  if (getTotalRequiredResources(priority) == 0) {
    unreserve(priority, node);
    return Resources.none();
  }

  // Fail early if the reserved container won't fit.
  // Note that we have an assumption here that there's only one container size
  // per priority.
  if (!Resources.fitsIn(node.getReservedContainer().getReservedResource(),
      node.getAvailableResource())) {
    return Resources.none();
  }

  return assignContainer(node, true);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:30,代码来源:FSAppAttempt.java


示例8: detachContainer

import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; //导入依赖的package包/类
@Override
public void detachContainer(Resource clusterResource,
    FiCaSchedulerApp application, RMContainer rmContainer) {
  if (application != null) {
    FiCaSchedulerNode node =
        scheduler.getNode(rmContainer.getContainer().getNodeId());
    releaseResource(clusterResource, application, rmContainer.getContainer()
        .getResource(), node.getLabels());
    LOG.info("movedContainer" + " container=" + rmContainer.getContainer()
        + " resource=" + rmContainer.getContainer().getResource()
        + " queueMoveOut=" + this + " usedCapacity=" + getUsedCapacity()
        + " absoluteUsedCapacity=" + getAbsoluteUsedCapacity() + " used="
        + queueUsage.getUsed() + " cluster=" + clusterResource);
    // Inform the parent queue
    getParent().detachContainer(clusterResource, application, rmContainer);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:LeafQueue.java


示例9: preemptContainer

import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; //导入依赖的package包/类
/**
 * Preempt a running container according to the priority
 */
@Override
public RMContainer preemptContainer() {
  if (LOG.isDebugEnabled()) {
    LOG.debug("App " + getName() + " is going to preempt a running " +
        "container");
  }

  RMContainer toBePreempted = null;
  for (RMContainer container : getLiveContainers()) {
    if (!getPreemptionContainers().contains(container) &&
        (toBePreempted == null ||
            comparator.compare(toBePreempted, container) > 0)) {
      toBePreempted = container;
    }
  }
  return toBePreempted;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:FSAppAttempt.java


示例10: recoverContainer

import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; //导入依赖的package包/类
public synchronized void recoverContainer(RMContainer rmContainer) {
  QueueMetrics metrics = queue.getMetrics();
  if (pending) {
    // If there was any container to recover, the application was
    // running from scheduler's POV.
    pending = false;
    metrics.runAppAttempt(applicationId, user);
  }

  // Container is completed. Skip recovering resources.
  if (rmContainer.getState().equals(RMContainerState.COMPLETED)) {
    return;
  }

  metrics.allocateResources(user, 1, rmContainer.getAllocatedResource(),
    false);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:AppSchedulingInfo.java


示例11: getTransferredContainers

import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; //导入依赖的package包/类
public synchronized List<Container> getTransferredContainers(
    ApplicationAttemptId currentAttempt) {
  ApplicationId appId = currentAttempt.getApplicationId();
  SchedulerApplication<T> app = applications.get(appId);
  List<Container> containerList = new ArrayList<Container>();
  RMApp appImpl = this.rmContext.getRMApps().get(appId);
  if (appImpl.getApplicationSubmissionContext().getUnmanagedAM()) {
    return containerList;
  }
  Collection<RMContainer> liveContainers =
      app.getCurrentAppAttempt().getLiveContainers();
  ContainerId amContainerId =
      rmContext.getRMApps().get(appId).getCurrentAppAttempt()
        .getMasterContainer().getId();
  for (RMContainer rmContainer : liveContainers) {
    if (!rmContainer.getContainerId().equals(amContainerId)) {
      containerList.add(rmContainer.getContainer());
    }
  }
  return containerList;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:AbstractYarnScheduler.java


示例12: releaseContainers

import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; //导入依赖的package包/类
protected void releaseContainers(List<ContainerId> containers,
    SchedulerApplicationAttempt attempt) {
  for (ContainerId containerId : containers) {
    RMContainer rmContainer = getRMContainer(containerId);
    if (rmContainer == null) {
      if (System.currentTimeMillis() - ResourceManager.getClusterTimeStamp()
          < nmExpireInterval) {
        LOG.info(containerId + " doesn't exist. Add the container"
            + " to the release request cache as it maybe on recovery.");
        synchronized (attempt) {
          attempt.getPendingRelease().add(containerId);
        }
      } else {
        RMAuditLogger.logFailure(attempt.getUser(),
          AuditConstants.RELEASE_CONTAINER,
          "Unauthorized access or invalid container", "Scheduler",
          "Trying to release container not owned by app or with invalid id.",
          attempt.getApplicationId(), containerId);
      }
    }
    completedContainer(rmContainer,
      SchedulerUtils.createAbnormalContainerStatus(containerId,
        SchedulerUtils.RELEASED_CONTAINER), RMContainerEventType.RELEASED);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:AbstractYarnScheduler.java


示例13: sortContainers

import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; //导入依赖的package包/类
/**
 * Compare by reversed priority order first, and then reversed containerId
 * order
 * @param containers
 */
@VisibleForTesting
static void sortContainers(List<RMContainer> containers){
  Collections.sort(containers, new Comparator<RMContainer>() {
    @Override
    public int compare(RMContainer a, RMContainer b) {
      Comparator<Priority> c = new org.apache.hadoop.yarn.server
          .resourcemanager.resource.Priority.Comparator();
      int priorityComp = c.compare(b.getContainer().getPriority(),
                                   a.getContainer().getPriority());
      if (priorityComp != 0) {
        return priorityComp;
      }
      return b.getContainerId().compareTo(a.getContainerId());
    }
  });
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:ProportionalCapacityPreemptionPolicy.java


示例14: recoverContainer

import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; //导入依赖的package包/类
@Override
public void recoverContainer(Resource clusterResource,
    SchedulerApplicationAttempt attempt, RMContainer rmContainer) {
  if (rmContainer.getState().equals(RMContainerState.COMPLETED)) {
    return;
  }
  // Careful! Locking order is important! 
  synchronized (this) {
    FiCaSchedulerNode node =
        scheduler.getNode(rmContainer.getContainer().getNodeId());
    super.allocateResource(clusterResource, rmContainer.getContainer()
        .getResource(), node.getLabels());
  }
  if (parent != null) {
    parent.recoverContainer(clusterResource, attempt, rmContainer);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:ParentQueue.java


示例15: attachContainer

import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; //导入依赖的package包/类
@Override
public void attachContainer(Resource clusterResource,
    FiCaSchedulerApp application, RMContainer rmContainer) {
  if (application != null) {
    FiCaSchedulerNode node =
        scheduler.getNode(rmContainer.getContainer().getNodeId());
    super.allocateResource(clusterResource, rmContainer.getContainer()
        .getResource(), node.getLabels());
    LOG.info("movedContainer" + " queueMoveIn=" + getQueueName()
        + " usedCapacity=" + getUsedCapacity() + " absoluteUsedCapacity="
        + getAbsoluteUsedCapacity() + " used=" + queueUsage.getUsed() + " cluster="
        + clusterResource);
    // Inform the parent
    if (parent != null) {
      parent.attachContainer(clusterResource, application, rmContainer);
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:ParentQueue.java


示例16: assignReservedContainer

import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; //导入依赖的package包/类
private synchronized CSAssignment assignReservedContainer(
    FiCaSchedulerApp application, FiCaSchedulerNode node,
    RMContainer rmContainer, Resource clusterResource) {
  // Do we still need this reservation?
  Priority priority = rmContainer.getReservedPriority();
  if (application.getTotalRequiredResources(priority) == 0) {
    // Release
    return new CSAssignment(application, rmContainer);
  }

  // Try to assign if we have sufficient resources
  assignContainersOnNode(clusterResource, node, application, priority, 
      rmContainer, new ResourceLimits(Resources.none()));
  
  // Doesn't matter... since it's already charged for at time of reservation
  // "re-reservation" is *free*
  return new CSAssignment(Resources.none(), NodeType.NODE_LOCAL);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:LeafQueue.java


示例17: createRMContainer

import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; //导入依赖的package包/类
private static RMContainer createRMContainer(ContainerId containerId) {
  RMContainer container = mock(RMContainer.class);
  when(container.getContainerId()).thenReturn(containerId);
  when(container.getAllocatedNode()).thenReturn(
      NodeId.newInstance("test host", -100));
  when(container.getAllocatedResource()).thenReturn(
      Resource.newInstance(-1, -1, -1));
  when(container.getAllocatedPriority()).thenReturn(Priority.UNDEFINED);
  when(container.getCreationTime()).thenReturn(Integer.MAX_VALUE + 1L);
  when(container.getFinishTime()).thenReturn(Integer.MAX_VALUE + 2L);
  when(container.getDiagnosticsInfo()).thenReturn("test diagnostics info");
  when(container.getContainerExitStatus()).thenReturn(-1);
  when(container.getContainerState()).thenReturn(ContainerState.COMPLETE);
  Container mockContainer = mock(Container.class);
  when(container.getContainer()).thenReturn(mockContainer);
  when(mockContainer.getNodeHttpAddress())
    .thenReturn("http://localhost:1234");
  return container;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:TestSystemMetricsPublisher.java


示例18: containerCreated

import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void containerCreated(RMContainer container, long createdTime) {
  if (publishSystemMetrics) {
    dispatcher.getEventHandler().handle(
        new ContainerCreatedEvent(
            container.getContainerId(),
            container.getAllocatedResource(),
            container.getAllocatedNode(),
            container.getAllocatedPriority(),
            createdTime, container.getNodeHttpAddress()));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:SystemMetricsPublisher.java


示例19: containerStarted

import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void containerStarted(RMContainer container) {
  if (historyServiceEnabled) {
    dispatcher.getEventHandler().handle(
      new WritingContainerStartEvent(container.getContainerId(),
        ContainerStartData.newInstance(container.getContainerId(),
          container.getAllocatedResource(), container.getAllocatedNode(),
          container.getAllocatedPriority(), container.getCreationTime())));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:RMApplicationHistoryWriter.java


示例20: containerFinished

import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void containerFinished(RMContainer container) {
  if (historyServiceEnabled) {
    dispatcher.getEventHandler().handle(
      new WritingContainerFinishEvent(container.getContainerId(),
        ContainerFinishData.newInstance(container.getContainerId(),
          container.getFinishTime(), container.getDiagnosticsInfo(),
          container.getContainerExitStatus(),
          container.getContainerState())));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:RMApplicationHistoryWriter.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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