org.apache.hadoop.yarn.server.resourcemanager.scheduler.Queue.getQueueName()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(11.7k)|赞(0)|评价(0)|浏览(89)

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

Queue.getQueueName介绍

[英]Get the queue name
[中]获取队列名称

代码示例

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

public String getQueueName() {
 try {
  this.readLock.lock();
  return queue.getQueueName();
 } finally {
  this.readLock.unlock();
 }
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager

public AppSchedulingInfo(ApplicationAttemptId appAttemptId,
  String user, Queue queue, ActiveUsersManager activeUsersManager,
  long epoch) {
 this.applicationAttemptId = appAttemptId;
 this.applicationId = appAttemptId.getApplicationId();
 this.queue = queue;
 this.queueName = queue.getQueueName();
 this.user = user;
 this.activeUsersManager = activeUsersManager;
 this.containerIdCounter = new AtomicLong(epoch << EPOCH_BIT_SHIFT);
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

public AppSchedulingInfo(ApplicationAttemptId appAttemptId,
  String user, Queue queue, ActiveUsersManager activeUsersManager,
  long epoch) {
 this.applicationAttemptId = appAttemptId;
 this.applicationId = appAttemptId.getApplicationId();
 this.queue = queue;
 this.queueName = queue.getQueueName();
 this.user = user;
 this.activeUsersManager = activeUsersManager;
 this.containerIdCounter = new AtomicLong(epoch << EPOCH_BIT_SHIFT);
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager

@Override
public synchronized List<ApplicationAttemptId>
  getAppsInQueue(String queueName) {
 if (queueName.equals(DEFAULT_QUEUE.getQueueName())) {
  List<ApplicationAttemptId> attempts =
    new ArrayList<ApplicationAttemptId>(applications.size());
  for (SchedulerApplication<FiCaSchedulerApp> app : applications.values()) {
   attempts.add(app.getCurrentAppAttempt().getApplicationAttemptId());
  }
  return attempts;
 } else {
  return null;
 }
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

@Override
public synchronized List<ApplicationAttemptId>
  getAppsInQueue(String queueName) {
 if (queueName.equals(DEFAULT_QUEUE.getQueueName())) {
  List<ApplicationAttemptId> attempts =
    new ArrayList<ApplicationAttemptId>(applications.size());
  for (SchedulerApplication<FiCaSchedulerApp> app : applications.values()) {
   attempts.add(app.getCurrentAppAttempt().getApplicationAttemptId());
  }
  return attempts;
 } else {
  return null;
 }
}

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

@Override
public synchronized List<ApplicationAttemptId>
  getAppsInQueue(String queueName) {
 if (queueName.equals(DEFAULT_QUEUE.getQueueName())) {
  List<ApplicationAttemptId> attempts =
    new ArrayList<ApplicationAttemptId>(applications.size());
  for (SchedulerApplication<FifoAppAttempt> app : applications.values()) {
   attempts.add(app.getCurrentAppAttempt().getApplicationAttemptId());
  }
  return attempts;
 } else {
  return null;
 }
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

@Override
protected int getNumberOfApplications(Queue queue) {
 int numberOfApplications = fs.getAppsInQueue(queue.getQueueName()).size();
 return numberOfApplications;
}

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

@Override
protected int getNumberOfApplications(Queue queue) {
 int numberOfApplications = fs.getAppsInQueue(queue.getQueueName()).size();
 return numberOfApplications;
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

@Override
public synchronized void addQueue(Queue queue)
  throws SchedulerDynamicEditException {
 if (!(queue instanceof ReservationQueue)) {
  throw new SchedulerDynamicEditException("Queue " + queue.getQueueName()
    + " is not a ReservationQueue");
 }
 ReservationQueue newQueue = (ReservationQueue) queue;
 if (newQueue.getParent() == null
   || !(newQueue.getParent() instanceof PlanQueue)) {
  throw new SchedulerDynamicEditException("ParentQueue for "
    + newQueue.getQueueName()
    + " is not properly set (should be set and be a PlanQueue)");
 }
 PlanQueue parentPlan = (PlanQueue) newQueue.getParent();
 String queuename = newQueue.getQueueName();
 parentPlan.addChildQueue(newQueue);
 this.queues.put(queuename, newQueue);
 LOG.info("Creation of ReservationQueue " + newQueue + " succeeded");
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager

@Override
public synchronized void addQueue(Queue queue)
  throws SchedulerDynamicEditException {
 if (!(queue instanceof ReservationQueue)) {
  throw new SchedulerDynamicEditException("Queue " + queue.getQueueName()
    + " is not a ReservationQueue");
 }
 ReservationQueue newQueue = (ReservationQueue) queue;
 if (newQueue.getParent() == null
   || !(newQueue.getParent() instanceof PlanQueue)) {
  throw new SchedulerDynamicEditException("ParentQueue for "
    + newQueue.getQueueName()
    + " is not properly set (should be set and be a PlanQueue)");
 }
 PlanQueue parentPlan = (PlanQueue) newQueue.getParent();
 String queuename = newQueue.getQueueName();
 parentPlan.addChildQueue(newQueue);
 this.queues.put(queuename, newQueue);
 LOG.info("Creation of ReservationQueue " + newQueue + " succeeded");
}

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

throw new YarnException("App to be moved " + appId + " not found.");
String sourceQueueName = application.getQueue().getQueueName();
this.queueManager.getAndCheckLeafQueue(sourceQueueName);
String destQueueName = handleMoveToPlanQueue(newQueue);

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

synchronized public void move(Queue newQueue) {
 QueueMetrics oldMetrics = queue.getMetrics();
 QueueMetrics newMetrics = newQueue.getMetrics();
 for (Map<String, ResourceRequest> asks : requests.values()) {
  ResourceRequest request = asks.get(ResourceRequest.ANY);
  if (request != null) {
   oldMetrics.decrPendingResources(user, request.getNumContainers(),
     request.getCapability());
   newMetrics.incrPendingResources(user, request.getNumContainers(),
     request.getCapability());
  }
 }
 oldMetrics.moveAppFrom(this);
 newMetrics.moveAppTo(this);
 activeUsersManager.deactivateApplication(user, applicationId);
 activeUsersManager = newQueue.getActiveUsersManager();
 activeUsersManager.activateApplication(user, applicationId);
 this.queue = newQueue;
 this.queueName = newQueue.getQueueName();
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

@Override
public QueueInfo getQueueInfo( 
  boolean includeChildQueues, boolean recursive) {
 QueueInfo queueInfo = recordFactory.newRecordInstance(QueueInfo.class);
 queueInfo.setQueueName(DEFAULT_QUEUE.getQueueName());
 queueInfo.setCapacity(1.0f);
 if (clusterResource.getMemory() == 0) {
  queueInfo.setCurrentCapacity(0.0f);
 } else {
  queueInfo.setCurrentCapacity((float) usedResource.getMemory()
    / clusterResource.getMemory());
 }
 queueInfo.setMaximumCapacity(1.0f);
 queueInfo.setChildQueues(new ArrayList<QueueInfo>());
 queueInfo.setQueueState(QueueState.RUNNING);
 return queueInfo;
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager

synchronized public void move(Queue newQueue) {
 QueueMetrics oldMetrics = queue.getMetrics();
 QueueMetrics newMetrics = newQueue.getMetrics();
 for (Map<String, ResourceRequest> asks : requests.values()) {
  ResourceRequest request = asks.get(ResourceRequest.ANY);
  if (request != null) {
   oldMetrics.decrPendingResources(user, request.getNumContainers(),
     request.getCapability());
   newMetrics.incrPendingResources(user, request.getNumContainers(),
     request.getCapability());
  }
 }
 oldMetrics.moveAppFrom(this);
 newMetrics.moveAppTo(this);
 activeUsersManager.deactivateApplication(user, applicationId);
 activeUsersManager = newQueue.getActiveUsersManager();
 activeUsersManager.activateApplication(user, applicationId);
 this.queue = newQueue;
 this.queueName = newQueue.getQueueName();
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager

@Override
public QueueInfo getQueueInfo( 
  boolean includeChildQueues, boolean recursive) {
 QueueInfo queueInfo = recordFactory.newRecordInstance(QueueInfo.class);
 queueInfo.setQueueName(DEFAULT_QUEUE.getQueueName());
 queueInfo.setCapacity(1.0f);
 if (clusterResource.getMemory() == 0) {
  queueInfo.setCurrentCapacity(0.0f);
 } else {
  queueInfo.setCurrentCapacity((float) usedResource.getMemory()
    / clusterResource.getMemory());
 }
 queueInfo.setMaximumCapacity(1.0f);
 queueInfo.setChildQueues(new ArrayList<QueueInfo>());
 queueInfo.setQueueState(QueueState.RUNNING);
 return queueInfo;
}

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

@Override
public QueueInfo getQueueInfo( 
  boolean includeChildQueues, boolean recursive) {
 QueueInfo queueInfo = recordFactory.newRecordInstance(QueueInfo.class);
 queueInfo.setQueueName(DEFAULT_QUEUE.getQueueName());
 queueInfo.setCapacity(1.0f);
 Resource clusterResource = getClusterResource();
 if (clusterResource.getMemorySize() == 0) {
  queueInfo.setCurrentCapacity(0.0f);
 } else {
  queueInfo.setCurrentCapacity((float) usedResource.getMemorySize()
    / clusterResource.getMemorySize());
 }
 queueInfo.setMaximumCapacity(1.0f);
 queueInfo.setChildQueues(new ArrayList<QueueInfo>());
 queueInfo.setQueueState(QueueState.RUNNING);
 return queueInfo;
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

private void checkAppQueue(MockRM resourceManager, String user,
  String submissionQueue, String expected)
  throws Exception {
 RMApp app = resourceManager.submitApp(200, "name", user,
   new HashMap<ApplicationAccessType, String>(), false, submissionQueue, -1,
   null, "MAPREDUCE", false);
 RMAppState expectedState = expected.isEmpty() ? RMAppState.FAILED
   : RMAppState.ACCEPTED;
 resourceManager.waitForState(app.getApplicationId(), expectedState);
 // get scheduler app
 CapacityScheduler cs = (CapacityScheduler)
   resourceManager.getResourceScheduler();
 SchedulerApplication schedulerApp =
   cs.getSchedulerApplications().get(app.getApplicationId());
 String queue = "";
 if (schedulerApp != null) {
  queue = schedulerApp.getQueue().getQueueName();
 }
 Assert.assertTrue("expected " + expected + " actual " + queue,
   expected.equals(queue));
 Assert.assertEquals(expected, app.getQueue());
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

FiCaSchedulerApp app =
  getApplicationAttempt(ApplicationAttemptId.newInstance(appId, 0));
String sourceQueueName = app.getQueue().getQueueName();
LeafQueue source = getAndCheckLeafQueue(sourceQueueName);
String destQueueName = handleMoveToPlanQueue(targetQueueName);

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

@Test
public void testAddAndRemoveAppFromCapacityScheduler() throws Exception {
 CapacitySchedulerConfiguration conf = new CapacitySchedulerConfiguration();
 setupQueueConfiguration(conf);
 conf.setClass(YarnConfiguration.RM_SCHEDULER, CapacityScheduler.class,
  ResourceScheduler.class);
 MockRM rm = new MockRM(conf);
 @SuppressWarnings("unchecked")
 AbstractYarnScheduler<SchedulerApplicationAttempt, SchedulerNode> cs =
   (AbstractYarnScheduler<SchedulerApplicationAttempt, SchedulerNode>) rm
    .getResourceScheduler();
 SchedulerApplication<SchedulerApplicationAttempt> app =
   TestSchedulerUtils.verifyAppAddedAndRemovedFromScheduler(
    cs.getSchedulerApplications(), cs, "a1");
 Assert.assertEquals("a1", app.getQueue().getQueueName());
}

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

@Test
public void testAddAndRemoveAppFromCapacityScheduler() throws Exception {
 CapacitySchedulerConfiguration conf = new CapacitySchedulerConfiguration();
 setupQueueConfiguration(conf);
 conf.setClass(YarnConfiguration.RM_SCHEDULER, CapacityScheduler.class,
  ResourceScheduler.class);
 MockRM rm = new MockRM(conf);
 @SuppressWarnings("unchecked")
 AbstractYarnScheduler<SchedulerApplicationAttempt, SchedulerNode> cs =
   (AbstractYarnScheduler<SchedulerApplicationAttempt, SchedulerNode>) rm
    .getResourceScheduler();
 SchedulerApplication<SchedulerApplicationAttempt> app =
   TestSchedulerUtils.verifyAppAddedAndRemovedFromScheduler(
    cs.getSchedulerApplications(), cs, "a1");
 Assert.assertEquals("a1", app.getQueue().getQueueName());
}

相关文章