• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java QueueEntitlement类的典型用法和代码示例

java 2次浏览

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

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

示例1: setEntitlement

点赞 3

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.QueueEntitlement; //导入依赖的package包/类
/**
 * This methods to change capacity for a queue and adjusts its
 * absoluteCapacity
 * 
 * @param entitlement the new entitlement for the queue (capacity,
 *          maxCapacity, etc..)
 * @throws SchedulerDynamicEditException
 */
public synchronized void setEntitlement(QueueEntitlement entitlement)
    throws SchedulerDynamicEditException {
  float capacity = entitlement.getCapacity();
  if (capacity < 0 || capacity > 1.0f) {
    throw new SchedulerDynamicEditException(
        "Capacity demand is not in the [0,1] range: " + capacity);
  }
  setCapacity(capacity);
  setAbsoluteCapacity(getParent().getAbsoluteCapacity() * getCapacity());
  setMaxApplications((int) (maxSystemApps * getAbsoluteCapacity()));
  // note: we currently set maxCapacity to capacity
  // this might be revised later
  setMaxCapacity(entitlement.getMaxCapacity());
  if (LOG.isDebugEnabled()) {
    LOG.debug("successfully changed to " + capacity + " for queue "
        + this.getQueueName());
  }
}
 

开发者ID:naver,
项目名称:hadoop,
代码行数:27,
代码来源:ReservationQueue.java

示例2: setEntitlement

点赞 3

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.QueueEntitlement; //导入依赖的package包/类
/**
 * This methods to change capacity for a queue and adjusts its
 * absoluteCapacity
 * 
 * @param entitlement the new entitlement for the queue (capacity,
 *          maxCapacity, etc..)
 * @throws SchedulerDynamicEditException
 */
public synchronized void setEntitlement(QueueEntitlement entitlement)
    throws SchedulerDynamicEditException {
  float capacity = entitlement.getCapacity();
  if (capacity < 0 || capacity > 1.0f) {
    throw new SchedulerDynamicEditException(
        "Capacity demand is not in the [0,1] range: " + capacity);
  }
  setCapacity(capacity);
  setAbsoluteCapacity(getParent().getAbsoluteCapacity() * getCapacity());
  // note: we currently set maxCapacity to capacity
  // this might be revised later
  setMaxCapacity(entitlement.getMaxCapacity());
  if (LOG.isDebugEnabled()) {
    LOG.debug("successfully changed to " + capacity + " for queue "
        + this.getQueueName());
  }
}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:26,
代码来源:ReservationQueue.java

示例3: cleanupExpiredQueues

点赞 3

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.QueueEntitlement; //导入依赖的package包/类
/**
 * First sets entitlement of queues to zero to prevent new app submission.
 * Then move all apps in the set of queues to the parent plan queue's default
 * reservation queue if move is enabled. Finally cleanups the queue by killing
 * any apps (if move is disabled or move failed) and removing the queue
 */
private void cleanupExpiredQueues(boolean shouldMove, Set<String> toRemove,
    String defReservationQueue) {
  for (String expiredReservation : toRemove) {
    try {
      // reduce entitlement to 0
      scheduler.setEntitlement(expiredReservation, new QueueEntitlement(0.0f,
          0.0f));
      if (shouldMove) {
        moveAppsInQueueSync(expiredReservation, defReservationQueue);
      }
      if (scheduler.getAppsInQueue(expiredReservation).size() > 0) {
        scheduler.killAllAppsInQueue(expiredReservation);
        LOG.info("Killing applications in queue: {}", expiredReservation);
      } else {
        scheduler.removeQueue(expiredReservation);
        LOG.info("Queue: " + expiredReservation + " removed");
      }
    } catch (YarnException e) {
      LOG.warn("Exception while trying to expire reservation: {}",
          expiredReservation, e);
    }
  }
}
 

开发者ID:Nextzero,
项目名称:hadoop-2.6.0-cdh5.4.3,
代码行数:30,
代码来源:CapacitySchedulerPlanFollower.java

示例4: setQueueEntitlement

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.QueueEntitlement; //导入依赖的package包/类
protected void setQueueEntitlement(String planQueueName, String currResId,
    float targetCapacity,
    float maxCapacity) throws YarnException {
  String reservationQueueName = getReservationQueueName(planQueueName,
      currResId);
  scheduler.setEntitlement(reservationQueueName, new QueueEntitlement(
      targetCapacity, maxCapacity));
}
 

开发者ID:naver,
项目名称:hadoop,
代码行数:9,
代码来源:AbstractSchedulerPlanFollower.java

示例5: setEntitlement

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.QueueEntitlement; //导入依赖的package包/类
@Override
public void setEntitlement(String queueName,
    QueueEntitlement entitlement) throws YarnException {

  FSLeafQueue reservationQueue = queueMgr.getLeafQueue(queueName, false);
  if (reservationQueue == null) {
    throw new YarnException("Target queue " + queueName
        + " not found or is not a leaf queue.");
  }

  reservationQueue.setWeights(entitlement.getCapacity());

  // TODO Does MaxCapacity need to be set for fairScheduler ?
}
 

开发者ID:naver,
项目名称:hadoop,
代码行数:15,
代码来源:FairScheduler.java

示例6: setEntitlement

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.QueueEntitlement; //导入依赖的package包/类
@Override
public synchronized void setEntitlement(String inQueue,
    QueueEntitlement entitlement) throws SchedulerDynamicEditException,
    YarnException {
  LeafQueue queue = getAndCheckLeafQueue(inQueue);
  ParentQueue parent = (ParentQueue) queue.getParent();

  if (!(queue instanceof ReservationQueue)) {
    throw new SchedulerDynamicEditException("Entitlement can not be"
        + " modified dynamically since queue " + inQueue
        + " is not a ReservationQueue");
  }

  if (!(parent instanceof PlanQueue)) {
    throw new SchedulerDynamicEditException("The parent of ReservationQueue "
        + inQueue + " must be an PlanQueue");
  }

  ReservationQueue newQueue = (ReservationQueue) queue;

  float sumChilds = ((PlanQueue) parent).sumOfChildCapacities();
  float newChildCap = sumChilds - queue.getCapacity() + entitlement.getCapacity();

  if (newChildCap >= 0 && newChildCap < 1.0f + CSQueueUtils.EPSILON) {
    // note: epsilon checks here are not ok, as the epsilons might accumulate
    // and become a problem in aggregate
    if (Math.abs(entitlement.getCapacity() - queue.getCapacity()) == 0
        && Math.abs(entitlement.getMaxCapacity() - queue.getMaximumCapacity()) == 0) {
      return;
    }
    newQueue.setEntitlement(entitlement);
  } else {
    throw new SchedulerDynamicEditException(
        "Sum of child queues would exceed 100% for PlanQueue: "
            + parent.getQueueName());
  }
  LOG.info("Set entitlement for ReservationQueue " + inQueue + "  to "
      + queue.getCapacity() + " request was (" + entitlement.getCapacity() + ")");
}
 

开发者ID:naver,
项目名称:hadoop,
代码行数:40,
代码来源:CapacityScheduler.java

示例7: testRefreshQueuesWithReservations

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.QueueEntitlement; //导入依赖的package包/类
@Test
public void testRefreshQueuesWithReservations() throws Exception {
  CapacityScheduler cs = (CapacityScheduler) rm.getResourceScheduler();

  // Test add one reservation dynamically and manually modify capacity
  ReservationQueue a1 =
      new ReservationQueue(cs, "a1", (PlanQueue) cs.getQueue("a"));
  cs.addQueue(a1);
  a1.setEntitlement(new QueueEntitlement(A1_CAPACITY / 100, 1f));

  // Test add another reservation queue and use setEntitlement to modify
  // capacity
  ReservationQueue a2 =
      new ReservationQueue(cs, "a2", (PlanQueue) cs.getQueue("a"));
  cs.addQueue(a2);
  cs.setEntitlement("a2", new QueueEntitlement(A2_CAPACITY / 100, 1.0f));

  // Verify all allocations match
  tcs.checkQueueCapacities(cs, A_CAPACITY, B_CAPACITY);

  // Reinitialize and verify all dynamic queued survived
  CapacitySchedulerConfiguration conf = cs.getConfiguration();
  conf.setCapacity(A, 80f);
  conf.setCapacity(B, 20f);
  cs.reinitialize(conf, rm.getRMContext());

  tcs.checkQueueCapacities(cs, 80f, 20f);
}
 

开发者ID:naver,
项目名称:hadoop,
代码行数:29,
代码来源:TestCapacitySchedulerDynamicBehavior.java

示例8: setEntitlement

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.QueueEntitlement; //导入依赖的package包/类
@Override
public void setEntitlement(String queue, QueueEntitlement entitlement)
    throws YarnException {
  throw new YarnException(getClass().getSimpleName()
      + " does not support this operation");
}
 

开发者ID:naver,
项目名称:hadoop,
代码行数:7,
代码来源:AbstractYarnScheduler.java

示例9: testMoveAppToPlanQueue

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.QueueEntitlement; //导入依赖的package包/类
@Test
public void testMoveAppToPlanQueue() throws Exception {
  CapacityScheduler scheduler = (CapacityScheduler) rm.getResourceScheduler();

  // submit an app
  RMApp app = rm.submitApp(GB, "test-move-1", "user_0", null, "b1");
  ApplicationAttemptId appAttemptId =
      rm.getApplicationReport(app.getApplicationId())
          .getCurrentApplicationAttemptId();

  // check preconditions
  List<ApplicationAttemptId> appsInB1 = scheduler.getAppsInQueue("b1");
  assertEquals(1, appsInB1.size());

  List<ApplicationAttemptId> appsInB = scheduler.getAppsInQueue("b");
  assertEquals(1, appsInB.size());
  assertTrue(appsInB.contains(appAttemptId));

  List<ApplicationAttemptId> appsInA = scheduler.getAppsInQueue("a");
  assertTrue(appsInA.isEmpty());

  String queue =
      scheduler.getApplicationAttempt(appsInB1.get(0)).getQueue()
          .getQueueName();
  Assert.assertTrue(queue.equals("b1"));

  List<ApplicationAttemptId> appsInRoot = scheduler.getAppsInQueue("root");
  assertTrue(appsInRoot.contains(appAttemptId));
  assertEquals(1, appsInRoot.size());

  // create the default reservation queue
  String defQName = "a" + ReservationConstants.DEFAULT_QUEUE_SUFFIX;
  ReservationQueue defQ =
      new ReservationQueue(scheduler, defQName,
          (PlanQueue) scheduler.getQueue("a"));
  scheduler.addQueue(defQ);
  defQ.setEntitlement(new QueueEntitlement(1f, 1f));

  List<ApplicationAttemptId> appsInDefQ = scheduler.getAppsInQueue(defQName);
  assertTrue(appsInDefQ.isEmpty());

  // now move the app to plan queue
  scheduler.moveApplication(app.getApplicationId(), "a");

  // check postconditions
  appsInDefQ = scheduler.getAppsInQueue(defQName);
  assertEquals(1, appsInDefQ.size());
  queue =
      scheduler.getApplicationAttempt(appsInDefQ.get(0)).getQueue()
          .getQueueName();
  Assert.assertTrue(queue.equals(defQName));

  appsInA = scheduler.getAppsInQueue("a");
  assertTrue(appsInA.contains(appAttemptId));
  assertEquals(1, appsInA.size());

  appsInRoot = scheduler.getAppsInQueue("root");
  assertTrue(appsInRoot.contains(appAttemptId));
  assertEquals(1, appsInRoot.size());

  appsInB1 = scheduler.getAppsInQueue("b1");
  assertTrue(appsInB1.isEmpty());

  appsInB = scheduler.getAppsInQueue("b");
  assertTrue(appsInB.isEmpty());

  rm.stop();
}
 

开发者ID:naver,
项目名称:hadoop,
代码行数:69,
代码来源:TestCapacitySchedulerDynamicBehavior.java

示例10: testMoveAppToPlanQueue

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.QueueEntitlement; //导入依赖的package包/类
@Test
public void testMoveAppToPlanQueue() throws Exception {
  CapacityScheduler scheduler = (CapacityScheduler) rm.getResourceScheduler();

  // submit an app
  RMApp app = rm.submitApp(GB, "test-move-1", "user_0", null, "b1");
  ApplicationAttemptId appAttemptId =
      rm.getApplicationReport(app.getApplicationId())
          .getCurrentApplicationAttemptId();

  // check preconditions
  List<ApplicationAttemptId> appsInB1 = scheduler.getAppsInQueue("b1");
  assertEquals(1, appsInB1.size());

  List<ApplicationAttemptId> appsInB = scheduler.getAppsInQueue("b");
  assertEquals(1, appsInB.size());
  assertTrue(appsInB.contains(appAttemptId));

  List<ApplicationAttemptId> appsInA = scheduler.getAppsInQueue("a");
  assertTrue(appsInA.isEmpty());

  String queue =
      scheduler.getApplicationAttempt(appsInB1.get(0)).getQueue()
          .getQueueName();
  Assert.assertTrue(queue.equals("b1"));

  List<ApplicationAttemptId> appsInRoot = scheduler.getAppsInQueue("root");
  assertTrue(appsInRoot.contains(appAttemptId));
  assertEquals(1, appsInRoot.size());

  // create the default reservation queue
  String defQName = "a" + PlanQueue.DEFAULT_QUEUE_SUFFIX;
  ReservationQueue defQ =
      new ReservationQueue(scheduler, defQName,
          (PlanQueue) scheduler.getQueue("a"));
  scheduler.addQueue(defQ);
  defQ.setEntitlement(new QueueEntitlement(1f, 1f));

  List<ApplicationAttemptId> appsInDefQ = scheduler.getAppsInQueue(defQName);
  assertTrue(appsInDefQ.isEmpty());

  // now move the app to plan queue
  scheduler.moveApplication(app.getApplicationId(), "a");

  // check postconditions
  appsInDefQ = scheduler.getAppsInQueue(defQName);
  assertEquals(1, appsInDefQ.size());
  queue =
      scheduler.getApplicationAttempt(appsInDefQ.get(0)).getQueue()
          .getQueueName();
  Assert.assertTrue(queue.equals(defQName));

  appsInA = scheduler.getAppsInQueue("a");
  assertTrue(appsInA.contains(appAttemptId));
  assertEquals(1, appsInA.size());

  appsInRoot = scheduler.getAppsInQueue("root");
  assertTrue(appsInRoot.contains(appAttemptId));
  assertEquals(1, appsInRoot.size());

  appsInB1 = scheduler.getAppsInQueue("b1");
  assertTrue(appsInB1.isEmpty());

  appsInB = scheduler.getAppsInQueue("b");
  assertTrue(appsInB.isEmpty());

  rm.stop();
}
 

开发者ID:Nextzero,
项目名称:hadoop-2.6.0-cdh5.4.3,
代码行数:69,
代码来源:TestCapacitySchedulerDynamicBehavior.java

示例11: setEntitlement

点赞 1

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.QueueEntitlement; //导入依赖的package包/类
/**
 * This method increase the entitlement for current queue (must respect
 * invariants, e.g., no overcommit of parents, non negative, etc.).
 * Entitlement is a general term for weights in FairScheduler, capacity for
 * the CapacityScheduler, etc.
 *
 * @param queue the queue for which we change entitlement
 * @param entitlement the new entitlement for the queue (capacity,
 *              maxCapacity, etc..)
 * @throws YarnException
 */
void setEntitlement(String queue, QueueEntitlement entitlement)
    throws YarnException;
 

开发者ID:naver,
项目名称:hadoop,
代码行数:14,
代码来源:YarnScheduler.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)