Java Code Examples for org.apache.hadoop.yarn.api.records.QueueInfo#setQueueName()

The following examples show how to use org.apache.hadoop.yarn.api.records.QueueInfo#setQueueName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FifoScheduler.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example 2
Source File: TestClientRMService.java    From hadoop with Apache License 2.0 6 votes vote down vote up
private void mockRMContext(YarnScheduler yarnScheduler, RMContext rmContext)
    throws IOException {
  Dispatcher dispatcher = mock(Dispatcher.class);
  when(rmContext.getDispatcher()).thenReturn(dispatcher);
  EventHandler eventHandler = mock(EventHandler.class);
  when(dispatcher.getEventHandler()).thenReturn(eventHandler);
  QueueInfo queInfo = recordFactory.newRecordInstance(QueueInfo.class);
  queInfo.setQueueName("testqueue");
  when(yarnScheduler.getQueueInfo(eq("testqueue"), anyBoolean(), anyBoolean()))
      .thenReturn(queInfo);
  when(yarnScheduler.getQueueInfo(eq("nonexistentqueue"), anyBoolean(), anyBoolean()))
      .thenThrow(new IOException("queue does not exist"));
  RMApplicationHistoryWriter writer = mock(RMApplicationHistoryWriter.class);
  when(rmContext.getRMApplicationHistoryWriter()).thenReturn(writer);
  SystemMetricsPublisher publisher = mock(SystemMetricsPublisher.class);
  when(rmContext.getSystemMetricsPublisher()).thenReturn(publisher);
  ConcurrentHashMap<ApplicationId, RMApp> apps = getRMApps(rmContext,
      yarnScheduler);
  when(rmContext.getRMApps()).thenReturn(apps);
  when(yarnScheduler.getAppsInQueue(eq("testqueue"))).thenReturn(
      getSchedulerApps(apps));
   ResourceScheduler rs = mock(ResourceScheduler.class);
   when(rmContext.getScheduler()).thenReturn(rs);
}
 
Example 3
Source File: FifoScheduler.java    From big-c with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example 4
Source File: TestClientRMService.java    From big-c with Apache License 2.0 6 votes vote down vote up
private void mockRMContext(YarnScheduler yarnScheduler, RMContext rmContext)
    throws IOException {
  Dispatcher dispatcher = mock(Dispatcher.class);
  when(rmContext.getDispatcher()).thenReturn(dispatcher);
  EventHandler eventHandler = mock(EventHandler.class);
  when(dispatcher.getEventHandler()).thenReturn(eventHandler);
  QueueInfo queInfo = recordFactory.newRecordInstance(QueueInfo.class);
  queInfo.setQueueName("testqueue");
  when(yarnScheduler.getQueueInfo(eq("testqueue"), anyBoolean(), anyBoolean()))
      .thenReturn(queInfo);
  when(yarnScheduler.getQueueInfo(eq("nonexistentqueue"), anyBoolean(), anyBoolean()))
      .thenThrow(new IOException("queue does not exist"));
  RMApplicationHistoryWriter writer = mock(RMApplicationHistoryWriter.class);
  when(rmContext.getRMApplicationHistoryWriter()).thenReturn(writer);
  SystemMetricsPublisher publisher = mock(SystemMetricsPublisher.class);
  when(rmContext.getSystemMetricsPublisher()).thenReturn(publisher);
  ConcurrentHashMap<ApplicationId, RMApp> apps = getRMApps(rmContext,
      yarnScheduler);
  when(rmContext.getRMApps()).thenReturn(apps);
  when(yarnScheduler.getAppsInQueue(eq("testqueue"))).thenReturn(
      getSchedulerApps(apps));
   ResourceScheduler rs = mock(ResourceScheduler.class);
   when(rmContext.getScheduler()).thenReturn(rs);
}
 
Example 5
Source File: FSQueue.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public QueueInfo getQueueInfo(boolean includeChildQueues, boolean recursive) {
  QueueInfo queueInfo = recordFactory.newRecordInstance(QueueInfo.class);
  queueInfo.setQueueName(getQueueName());

  if (scheduler.getClusterResource().getMemory() == 0) {
    queueInfo.setCapacity(0.0f);
  } else {
    queueInfo.setCapacity((float) getFairShare().getMemory() /
        scheduler.getClusterResource().getMemory());
  }

  if (getFairShare().getMemory() == 0) {
    queueInfo.setCurrentCapacity(0.0f);
  } else {
    queueInfo.setCurrentCapacity((float) getResourceUsage().getMemory() /
        getFairShare().getMemory());
  }

  ArrayList<QueueInfo> childQueueInfos = new ArrayList<QueueInfo>();
  if (includeChildQueues) {
    Collection<FSQueue> childQueues = getChildQueues();
    for (FSQueue child : childQueues) {
      childQueueInfos.add(child.getQueueInfo(recursive, recursive));
    }
  }
  queueInfo.setChildQueues(childQueueInfos);
  queueInfo.setQueueState(QueueState.RUNNING);
  return queueInfo;
}
 
Example 6
Source File: AbstractCSQueue.java    From hadoop with Apache License 2.0 5 votes vote down vote up
protected QueueInfo getQueueInfo() {
  QueueInfo queueInfo = recordFactory.newRecordInstance(QueueInfo.class);
  queueInfo.setQueueName(queueName);
  queueInfo.setAccessibleNodeLabels(accessibleLabels);
  queueInfo.setCapacity(queueCapacities.getCapacity());
  queueInfo.setMaximumCapacity(queueCapacities.getMaximumCapacity());
  queueInfo.setQueueState(state);
  queueInfo.setDefaultNodeLabelExpression(defaultLabelExpression);
  queueInfo.setCurrentCapacity(getUsedCapacity());
  return queueInfo;
}
 
Example 7
Source File: FSQueue.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public QueueInfo getQueueInfo(boolean includeChildQueues, boolean recursive) {
  QueueInfo queueInfo = recordFactory.newRecordInstance(QueueInfo.class);
  queueInfo.setQueueName(getQueueName());

  if (scheduler.getClusterResource().getMemory() == 0) {
    queueInfo.setCapacity(0.0f);
  } else {
    queueInfo.setCapacity((float) getFairShare().getMemory() /
        scheduler.getClusterResource().getMemory());
  }

  if (getFairShare().getMemory() == 0) {
    queueInfo.setCurrentCapacity(0.0f);
  } else {
    queueInfo.setCurrentCapacity((float) getResourceUsage().getMemory() /
        getFairShare().getMemory());
  }

  ArrayList<QueueInfo> childQueueInfos = new ArrayList<QueueInfo>();
  if (includeChildQueues) {
    Collection<FSQueue> childQueues = getChildQueues();
    for (FSQueue child : childQueues) {
      childQueueInfos.add(child.getQueueInfo(recursive, recursive));
    }
  }
  queueInfo.setChildQueues(childQueueInfos);
  queueInfo.setQueueState(QueueState.RUNNING);
  return queueInfo;
}
 
Example 8
Source File: AbstractCSQueue.java    From big-c with Apache License 2.0 5 votes vote down vote up
protected QueueInfo getQueueInfo() {
  QueueInfo queueInfo = recordFactory.newRecordInstance(QueueInfo.class);
  queueInfo.setQueueName(queueName);
  queueInfo.setAccessibleNodeLabels(accessibleLabels);
  queueInfo.setCapacity(queueCapacities.getCapacity());
  queueInfo.setMaximumCapacity(queueCapacities.getMaximumCapacity());
  queueInfo.setQueueState(state);
  queueInfo.setDefaultNodeLabelExpression(defaultLabelExpression);
  queueInfo.setCurrentCapacity(getUsedCapacity());
  return queueInfo;
}