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


Java LeafQueue类代码示例

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


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

示例1: getQueues

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.LeafQueue; //导入依赖的package包/类
protected CapacitySchedulerQueueInfoList getQueues(CSQueue parent,
    NodeLabel nodeLabel) {
  CSQueue parentQueue = parent;
  CapacitySchedulerQueueInfoList queuesInfo =
      new CapacitySchedulerQueueInfoList();
  for (CSQueue queue : parentQueue.getChildQueues()) {
    CapacitySchedulerQueueInfo info;
    if (queue instanceof LeafQueue) {
      info =
          new CapacitySchedulerLeafQueueInfo((LeafQueue) queue,
              nodeLabel.getLabelName());
    } else {
      info = new CapacitySchedulerQueueInfo(queue, nodeLabel.getLabelName());
      info.queues = getQueues(queue, nodeLabel);
    }
    queuesInfo.addToQueueInfoList(info);
  }
  return queuesInfo;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:CapacitySchedulerInfo.java

示例2: checkCSLeafQueue

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.LeafQueue; //导入依赖的package包/类
private void checkCSLeafQueue(MockRM rm,
    SchedulerApplication<SchedulerApplicationAttempt> app,
    Resource clusterResource, Resource queueResource, Resource usedResource,
    int numContainers) {
  LeafQueue leafQueue = (LeafQueue) app.getQueue();
  // assert queue used resources.
  assertEquals(usedResource, leafQueue.getUsedResources());
  assertEquals(numContainers, leafQueue.getNumContainers());

  ResourceCalculator calc =
      ((CapacityScheduler) rm.getResourceScheduler()).getResourceCalculator();
  float usedCapacity =
      Resources.divide(calc, clusterResource, usedResource, queueResource);
  // assert queue used capacity
  assertEquals(usedCapacity, leafQueue.getUsedCapacity(), 1e-8);
  float absoluteUsedCapacity =
      Resources.divide(calc, clusterResource, usedResource, clusterResource);
  // assert queue absolute capacity
  assertEquals(absoluteUsedCapacity, leafQueue.getAbsoluteUsedCapacity(),
    1e-8);
  // assert user consumed resources.
  assertEquals(usedResource, leafQueue.getUser(app.getUser())
    .getUsed());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:TestWorkPreservingRMRestart.java

示例3: printString

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.LeafQueue; //导入依赖的package包/类
void printString(CSQueue nq, String indent) {
  if (nq instanceof ParentQueue) {
    System.out.println(indent + nq.getQueueName()
        + " cur:" + nq.getAbsoluteUsedCapacity()
        + " guar:" + nq.getAbsoluteCapacity()
        );
    for (CSQueue q : ((ParentQueue)nq).getChildQueues()) {
      printString(q, indent + "  ");
    }
  } else {
    System.out.println(indent + nq.getQueueName()
        + " pen:" + ((LeafQueue) nq).getTotalResourcePending()
        + " cur:" + nq.getAbsoluteUsedCapacity()
        + " guar:" + nq.getAbsoluteCapacity()
        );
    for (FiCaSchedulerApp a : ((LeafQueue)nq).getApplications()) {
      System.out.println(indent + "  " + a.getApplicationId());
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:TestProportionalCapacityPreemptionPolicy.java

示例4: CapacitySchedulerLeafQueueInfo

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.LeafQueue; //导入依赖的package包/类
CapacitySchedulerLeafQueueInfo(LeafQueue q) {
  super(q);
  numActiveApplications = q.getNumActiveApplications();
  numPendingApplications = q.getNumPendingApplications();
  numContainers = q.getNumContainers();
  maxApplications = q.getMaxApplications();
  maxApplicationsPerUser = q.getMaxApplicationsPerUser();
  userLimit = q.getUserLimit();
  users = new UsersInfo(q.getUsers());
  userLimitFactor = q.getUserLimitFactor();
  AMResourceLimit = new ResourceInfo(q.getAMResourceLimit());
  usedAMResource = new ResourceInfo(q.getQueueResourceUsage().getAMUsed());
  userAMResourceLimit = new ResourceInfo(q.getUserAMResourceLimit());
  preemptionDisabled = q.getPreemptionDisabled();
  orderingPolicyInfo = q.getOrderingPolicy().getInfo();
  defaultNodeLabelExpression = q.getDefaultNodeLabelExpression();
  defaultPriority = q.getDefaultApplicationPriority().getPriority();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:19,代码来源:CapacitySchedulerLeafQueueInfo.java

示例5: getQueues

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.LeafQueue; //导入依赖的package包/类
protected CapacitySchedulerQueueInfoList getQueues(CSQueue parent) {
  CSQueue parentQueue = parent;
  CapacitySchedulerQueueInfoList queuesInfo =
      new CapacitySchedulerQueueInfoList();
  for (CSQueue queue : parentQueue.getChildQueues()) {
    CapacitySchedulerQueueInfo info;
    if (queue instanceof LeafQueue) {
      info =
          new CapacitySchedulerLeafQueueInfo((LeafQueue) queue);
    } else {
      info = new CapacitySchedulerQueueInfo(queue);
      info.queues = getQueues(queue);
    }
    queuesInfo.addToQueueInfoList(info);
  }
  return queuesInfo;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:18,代码来源:CapacitySchedulerInfo.java

示例6: getPendingAppDiagnosticMessage

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.LeafQueue; //导入依赖的package包/类
protected void getPendingAppDiagnosticMessage(
    StringBuilder diagnosticMessage) {
  LeafQueue queue = getCSLeafQueue();
  diagnosticMessage.append(" Details : AM Partition = ");
  diagnosticMessage.append(appAMNodePartitionName.isEmpty()
      ? NodeLabel.DEFAULT_NODE_LABEL_PARTITION : appAMNodePartitionName);
  diagnosticMessage.append("; ");
  diagnosticMessage.append("AM Resource Request = ");
  diagnosticMessage.append(getAMResource(appAMNodePartitionName));
  diagnosticMessage.append("; ");
  diagnosticMessage.append("Queue Resource Limit for AM = ");
  diagnosticMessage
      .append(queue.getAMResourceLimitPerPartition(appAMNodePartitionName));
  diagnosticMessage.append("; ");
  diagnosticMessage.append("User AM Resource Limit of the queue = ");
  diagnosticMessage.append(
      queue.getUserAMResourceLimitPerPartition(appAMNodePartitionName));
  diagnosticMessage.append("; ");
  diagnosticMessage.append("Queue AM Resource Usage = ");
  diagnosticMessage.append(
      queue.getQueueResourceUsage().getAMUsed(appAMNodePartitionName));
  diagnosticMessage.append("; ");
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:24,代码来源:FiCaSchedulerApp.java

示例7: getActivedAppDiagnosticMessage

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.LeafQueue; //导入依赖的package包/类
protected void getActivedAppDiagnosticMessage(
    StringBuilder diagnosticMessage) {
  LeafQueue queue = getCSLeafQueue();
  QueueCapacities queueCapacities = queue.getQueueCapacities();
  diagnosticMessage.append(" Details : AM Partition = ");
  diagnosticMessage.append(appAMNodePartitionName.isEmpty()
      ? NodeLabel.DEFAULT_NODE_LABEL_PARTITION : appAMNodePartitionName);
  diagnosticMessage.append(" ; ");
  diagnosticMessage.append("Partition Resource = ");
  diagnosticMessage.append(rmContext.getNodeLabelManager()
      .getResourceByLabel(appAMNodePartitionName, Resources.none()));
  diagnosticMessage.append(" ; ");
  diagnosticMessage.append("Queue's Absolute capacity = ");
  diagnosticMessage.append(
      queueCapacities.getAbsoluteCapacity(appAMNodePartitionName) * 100);
  diagnosticMessage.append(" % ; ");
  diagnosticMessage.append("Queue's Absolute used capacity = ");
  diagnosticMessage.append(
      queueCapacities.getAbsoluteUsedCapacity(appAMNodePartitionName) * 100);
  diagnosticMessage.append(" % ; ");
  diagnosticMessage.append("Queue's Absolute max capacity = ");
  diagnosticMessage.append(
      queueCapacities.getAbsoluteMaximumCapacity(appAMNodePartitionName)
          * 100);
  diagnosticMessage.append(" % ; ");
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:27,代码来源:FiCaSchedulerApp.java

示例8: printString

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.LeafQueue; //导入依赖的package包/类
void printString(CSQueue nq, String indent) {
  if (nq instanceof ParentQueue) {
    System.out.println(indent + nq.getQueueName()
        + " cur:" + nq.getAbsoluteUsedCapacity()
        + " guar:" + nq.getAbsoluteCapacity()
        );
    for (CSQueue q : ((ParentQueue)nq).getChildQueues()) {
      printString(q, indent + "  ");
    }
  } else {
    System.out.println(indent + nq.getQueueName()
        + " pen:"
            + ((LeafQueue) nq).getTotalPendingResourcesConsideringUserLimit(
                                      isA(Resource.class), isA(String.class))
        + " cur:" + nq.getAbsoluteUsedCapacity()
        + " guar:" + nq.getAbsoluteCapacity()
        );
    for (FiCaSchedulerApp a : ((LeafQueue)nq).getApplications()) {
      System.out.println(indent + "  " + a.getApplicationId());
    }
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:23,代码来源:TestProportionalCapacityPreemptionPolicy.java

示例9: checkCSQueue

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.LeafQueue; //导入依赖的package包/类
private void checkCSQueue(MockRM rm,
    SchedulerApplication<SchedulerApplicationAttempt> app,
    Resource clusterResource, Resource queueResource, Resource usedResource,
    int numContainers)
    throws Exception {
  checkCSLeafQueue(rm2, app, clusterResource, queueResource, usedResource,
    numContainers);

  LeafQueue queue = (LeafQueue) app.getQueue();
  Resource availableResources = Resources.subtract(queueResource, usedResource);
  // ************* check Queue metrics ************
  QueueMetrics queueMetrics = queue.getMetrics();
  asserteMetrics(queueMetrics, 1, 0, 1, 0, 2, availableResources.getMemory(),
    availableResources.getVirtualCores(), usedResource.getMemory(),
    usedResource.getVirtualCores());

  // ************ check user metrics ***********
  QueueMetrics userMetrics =
      queueMetrics.getUserMetrics(app.getUser());
  asserteMetrics(userMetrics, 1, 0, 1, 0, 2, availableResources.getMemory(),
    availableResources.getVirtualCores(), usedResource.getMemory(),
    usedResource.getVirtualCores());
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:24,代码来源:TestWorkPreservingRMRestart.java

示例10: checkCSLeafQueue

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.LeafQueue; //导入依赖的package包/类
private void checkCSLeafQueue(MockRM rm,
    SchedulerApplication<SchedulerApplicationAttempt> app,
    Resource clusterResource, Resource queueResource, Resource usedResource,
    int numContainers) {
  LeafQueue leafQueue = (LeafQueue) app.getQueue();
  // assert queue used resources.
  assertEquals(usedResource, leafQueue.getUsedResources());
  assertEquals(numContainers, leafQueue.getNumContainers());

  ResourceCalculator calc =
      ((CapacityScheduler) rm.getResourceScheduler()).getResourceCalculator();
  float usedCapacity =
      Resources.divide(calc, clusterResource, usedResource, queueResource);
  // assert queue used capacity
  assertEquals(usedCapacity, leafQueue.getUsedCapacity(), 1e-8);
  float absoluteUsedCapacity =
      Resources.divide(calc, clusterResource, usedResource, clusterResource);
  // assert queue absolute capacity
  assertEquals(absoluteUsedCapacity, leafQueue.getAbsoluteUsedCapacity(),
    1e-8);
  // assert user consumed resources.
  assertEquals(usedResource, leafQueue.getUser(app.getUser())
    .getTotalConsumedResources());
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:25,代码来源:TestWorkPreservingRMRestart.java

示例11: calculateUsedAMResourcesPerQueue

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.LeafQueue; //导入依赖的package包/类
private Resource calculateUsedAMResourcesPerQueue(String partition,
    LeafQueue leafQueue, Map<String, Resource> perUserAMUsed) {
  Collection<FiCaSchedulerApp> runningApps = leafQueue.getApplications();
  Resource amUsed = Resources.createResource(0, 0);

  for (FiCaSchedulerApp app : runningApps) {
    Resource userAMResource = perUserAMUsed.get(app.getUser());
    if (null == userAMResource) {
      userAMResource = Resources.createResource(0, 0);
      perUserAMUsed.put(app.getUser(), userAMResource);
    }

    Resources.addTo(userAMResource, app.getAMResource(partition));
    Resources.addTo(amUsed, app.getAMResource(partition));
  }
  return amUsed;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:18,代码来源:FifoIntraQueuePreemptionPlugin.java

示例12: CapacitySchedulerLeafQueueInfo

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.LeafQueue; //导入依赖的package包/类
CapacitySchedulerLeafQueueInfo(LeafQueue q, String nodeLabel) {
  super(q, nodeLabel);
  numActiveApplications = q.getNumActiveApplications();
  numPendingApplications = q.getNumPendingApplications();
  numContainers = q.getNumContainers();
  maxApplications = q.getMaxApplications();
  maxApplicationsPerUser = q.getMaxApplicationsPerUser();
  userLimit = q.getUserLimit();
  users = new UsersInfo(q.getUsers());
  userLimitFactor = q.getUserLimitFactor();
  AMResourceLimit = new ResourceInfo(q.getAMResourceLimit());
  usedAMResource = new ResourceInfo(q.getQueueResourceUsage().getAMUsed());
  userAMResourceLimit = new ResourceInfo(q.getUserAMResourceLimit());
  preemptionDisabled = q.getPreemptionDisabled();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:CapacitySchedulerLeafQueueInfo.java

示例13: checkCSQueue

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.LeafQueue; //导入依赖的package包/类
private void checkCSQueue(MockRM rm,
    SchedulerApplication<SchedulerApplicationAttempt> app,
    Resource clusterResource, Resource queueResource, Resource usedResource,
    int numContainers)
    throws Exception {
  checkCSLeafQueue(rm, app, clusterResource, queueResource, usedResource,
      numContainers);

  LeafQueue queue = (LeafQueue) app.getQueue();
  Resource availableResources =
      Resources.subtract(queueResource, usedResource);
  // ************ check app headroom ****************
  SchedulerApplicationAttempt schedulerAttempt = app.getCurrentAppAttempt();
  assertEquals(availableResources, schedulerAttempt.getHeadroom());

  // ************* check Queue metrics ************
  QueueMetrics queueMetrics = queue.getMetrics();
  assertMetrics(queueMetrics, 1, 0, 1, 0, 2, availableResources.getMemory(),
      availableResources.getVirtualCores(), usedResource.getMemory(),
      usedResource.getVirtualCores());

  // ************ check user metrics ***********
  QueueMetrics userMetrics =
      queueMetrics.getUserMetrics(app.getUser());
  assertMetrics(userMetrics, 1, 0, 1, 0, 2, availableResources.getMemory(),
      availableResources.getVirtualCores(), usedResource.getMemory(),
      usedResource.getVirtualCores());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:29,代码来源:TestWorkPreservingRMRestart.java

示例14: mockLeafQueue

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.LeafQueue; //导入依赖的package包/类
LeafQueue mockLeafQueue(ParentQueue p, float tot, int i, int[] abs, 
    int[] used, int[] pending, int[] reserved, int[] apps, int[] gran) {
  LeafQueue lq = mock(LeafQueue.class);
  List<ApplicationAttemptId> appAttemptIdList = 
      new ArrayList<ApplicationAttemptId>();
  when(lq.getTotalResourcePending()).thenReturn(
      Resource.newInstance(pending[i], 0, 0));
  // consider moving where CapacityScheduler::comparator accessible
  NavigableSet<FiCaSchedulerApp> qApps = new TreeSet<FiCaSchedulerApp>(
    new Comparator<FiCaSchedulerApp>() {
      @Override
      public int compare(FiCaSchedulerApp a1, FiCaSchedulerApp a2) {
        return a1.getApplicationAttemptId()
            .compareTo(a2.getApplicationAttemptId());
      }
    });
  // applications are added in global L->R order in queues
  if (apps[i] != 0) {
    int aUsed    = used[i] / apps[i];
    int aPending = pending[i] / apps[i];
    int aReserve = reserved[i] / apps[i];
    for (int a = 0; a < apps[i]; ++a) {
      FiCaSchedulerApp mockFiCaApp =
          mockApp(i, appAlloc, aUsed, aPending, aReserve, gran[i]);
      qApps.add(mockFiCaApp);
      ++appAlloc;
      appAttemptIdList.add(mockFiCaApp.getApplicationAttemptId());
    }
    when(mCS.getAppsInQueue("queue" + (char)('A' + i - 1)))
            .thenReturn(appAttemptIdList);
  }
  when(lq.getApplications()).thenReturn(qApps);
  if(setAMResourcePercent != 0.0f){
    when(lq.getMaxAMResourcePerQueuePercent()).thenReturn(setAMResourcePercent);
  }
  p.getChildQueues().add(lq);
  return lq;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:39,代码来源:TestProportionalCapacityPreemptionPolicy.java

示例15: getApp

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.LeafQueue; //导入依赖的package包/类
private FiCaSchedulerApp getApp(String queueName, int appId) {
  for (FiCaSchedulerApp app : ((LeafQueue) cs.getQueue(queueName))
      .getApplications()) {
    if (app.getApplicationId().getId() == appId) {
      return app;
    }
  }
  return null;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:10,代码来源:TestProportionalCapacityPreemptionPolicyForNodePartitions.java


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