org.apache.hadoop.yarn.api.records.Container.getAllocationTags()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(95)

本文整理了Java中org.apache.hadoop.yarn.api.records.Container.getAllocationTags()方法的一些代码示例,展示了Container.getAllocationTags()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Container.getAllocationTags()方法的具体详情如下:
包路径:org.apache.hadoop.yarn.api.records.Container
类名称:Container
方法名:getAllocationTags

Container.getAllocationTags介绍

暂无

代码示例

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-common

if (container.getAllocationTags() != null
  && !container.getAllocationTags().isEmpty()) {
 List<SchedulingRequest> schedReqs =
   outstandingSchedRequests.get(container.getAllocationTags());
 if (schedReqs != null && !schedReqs.isEmpty()) {
  Iterator<SchedulingRequest> iter = schedReqs.iterator();

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

public RMContainerImpl(Container container, SchedulerRequestKey schedulerKey,
  ApplicationAttemptId appAttemptId, NodeId nodeId, String user,
  RMContext rmContext, long creationTime, String nodeLabelExpression,
  boolean isExternallyAllocated) {
 this.stateMachine = stateMachineFactory.make(this);
 this.nodeId = nodeId;
 this.container = container;
 this.allocatedSchedulerKey = schedulerKey;
 this.appAttemptId = appAttemptId;
 this.user = user;
 this.creationTime = creationTime;
 this.rmContext = rmContext;
 this.eventHandler = rmContext.getDispatcher().getEventHandler();
 this.containerAllocationExpirer = rmContext.getContainerAllocationExpirer();
 this.isAMContainer = false;
 this.nodeLabelExpression = nodeLabelExpression;
 this.lastConfirmedResource = container.getResource();
 this.isExternallyAllocated = isExternallyAllocated;
 ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
 this.readLock = lock.readLock();
 this.writeLock = lock.writeLock();
 saveNonAMContainerMetaInfo =
   shouldPublishNonAMContainerEventstoATS(rmContext);
 if (container.getId() != null) {
  rmContext.getRMApplicationHistoryWriter().containerStarted(this);
 }
 if (this.container != null) {
  this.allocationTags = this.container.getAllocationTags();
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

rmContext.getAllocationTagsManager()
  .removeContainer(container.getNodeId(),
    container.getId(), container.getAllocationTags());

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

private List<Container> waitForAllocation(int allocNum, int timeout,
  MockAM am, MockNM... nms) throws Exception {
 final List<Container> result = new ArrayList<>();
 GenericTestUtils.waitFor(() -> {
  try {
   AllocateResponse response = am.schedule();
   List<Container> allocated = response.getAllocatedContainers();
   System.out.println("Expecting allocation: " + allocNum
     + ", actual allocation: " + allocated.size());
   for (Container c : allocated) {
    System.out.println("Container " + c.getId().toString()
      + " is allocated on node: " + c.getNodeId().toString()
      + ", allocation tags: "
      + String.join(",", c.getAllocationTags()));
   }
   result.addAll(allocated);
   if (result.size() == allocNum) {
    return true;
   }
   doNodeHeartbeat(nms);
  } catch (Exception e) {
   e.printStackTrace();
  }
  return false;
 }, 500, timeout);
 return result;
}

相关文章