Search in sources :

Example 1 with QueueInfo

use of org.apache.hadoop.yarn.api.records.QueueInfo in project hadoop by apache.

the class TestLeafQueue method createQueue.

private AbstractCSQueue createQueue(String name, Queue parent, float capacity, float absCap) {
    CSQueueMetrics metrics = CSQueueMetrics.forQueue(name, parent, false, cs.getConf());
    QueueInfo queueInfo = QueueInfo.newInstance(name, capacity, 1.0f, 0, null, null, QueueState.RUNNING, null, "", null, false);
    ActiveUsersManager activeUsersManager = new ActiveUsersManager(metrics);
    AbstractCSQueue queue = mock(AbstractCSQueue.class);
    when(queue.getMetrics()).thenReturn(metrics);
    when(queue.getAbstractUsersManager()).thenReturn(activeUsersManager);
    when(queue.getQueueInfo(false, false)).thenReturn(queueInfo);
    QueueCapacities qCaps = mock(QueueCapacities.class);
    when(qCaps.getAbsoluteCapacity(any())).thenReturn(absCap);
    when(queue.getQueueCapacities()).thenReturn(qCaps);
    return queue;
}
Also used : QueueInfo(org.apache.hadoop.yarn.api.records.QueueInfo) ActiveUsersManager(org.apache.hadoop.yarn.server.resourcemanager.scheduler.ActiveUsersManager)

Example 2 with QueueInfo

use of org.apache.hadoop.yarn.api.records.QueueInfo in project hadoop by apache.

the class TestClientRMService method mockRMContext.

private void mockRMContext(YarnScheduler yarnScheduler, RMContext rmContext) throws IOException {
    Dispatcher dispatcher = mock(Dispatcher.class);
    when(rmContext.getDispatcher()).thenReturn(dispatcher);
    @SuppressWarnings("unchecked") EventHandler<Event> 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);
    when(rmContext.getYarnConfiguration()).thenReturn(new YarnConfiguration());
    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);
}
Also used : QueueInfo(org.apache.hadoop.yarn.api.records.QueueInfo) RMApp(org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp) RMApplicationHistoryWriter(org.apache.hadoop.yarn.server.resourcemanager.ahs.RMApplicationHistoryWriter) IOException(java.io.IOException) Dispatcher(org.apache.hadoop.yarn.event.Dispatcher) SystemMetricsPublisher(org.apache.hadoop.yarn.server.resourcemanager.metrics.SystemMetricsPublisher) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) Event(org.apache.hadoop.yarn.event.Event) RMAppEvent(org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent) ResourceScheduler(org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId)

Example 3 with QueueInfo

use of org.apache.hadoop.yarn.api.records.QueueInfo in project hadoop by apache.

the class TestApplicationClientProtocolOnHA method testGetQueueInfoOnHA.

@Test(timeout = 15000)
public void testGetQueueInfoOnHA() throws Exception {
    QueueInfo queueInfo = client.getQueueInfo("root");
    Assert.assertTrue(queueInfo != null);
    Assert.assertEquals(cluster.createFakeQueueInfo(), queueInfo);
}
Also used : QueueInfo(org.apache.hadoop.yarn.api.records.QueueInfo) Test(org.junit.Test)

Example 4 with QueueInfo

use of org.apache.hadoop.yarn.api.records.QueueInfo in project hadoop by apache.

the class QueueCLI method listQueue.

/**
   * Lists the Queue Information matching the given queue name
   * 
   * @param queueName
   * @throws YarnException
   * @throws IOException
   */
private int listQueue(String queueName) throws YarnException, IOException {
    int rc;
    PrintWriter writer = new PrintWriter(new OutputStreamWriter(sysout, Charset.forName("UTF-8")));
    QueueInfo queueInfo = client.getQueueInfo(queueName);
    if (queueInfo != null) {
        writer.println("Queue Information : ");
        printQueueInfo(writer, queueInfo);
        rc = 0;
    } else {
        writer.println("Cannot get queue from RM by queueName = " + queueName + ", please check.");
        rc = -1;
    }
    writer.flush();
    return rc;
}
Also used : QueueInfo(org.apache.hadoop.yarn.api.records.QueueInfo) OutputStreamWriter(java.io.OutputStreamWriter) PrintWriter(java.io.PrintWriter)

Example 5 with QueueInfo

use of org.apache.hadoop.yarn.api.records.QueueInfo in project hadoop by apache.

the class YarnClientImpl method getRootQueueInfos.

@Override
public List<QueueInfo> getRootQueueInfos() throws YarnException, IOException {
    List<QueueInfo> queues = new ArrayList<QueueInfo>();
    QueueInfo rootQueue = rmClient.getQueueInfo(getQueueInfoRequest(ROOT, false, true, true)).getQueueInfo();
    getChildQueues(rootQueue, queues, false);
    return queues;
}
Also used : QueueInfo(org.apache.hadoop.yarn.api.records.QueueInfo) ArrayList(java.util.ArrayList)

Aggregations

QueueInfo (org.apache.hadoop.yarn.api.records.QueueInfo)33 Test (org.junit.Test)11 Resource (org.apache.hadoop.yarn.api.records.Resource)9 ArrayList (java.util.ArrayList)8 IOException (java.io.IOException)7 LocalResource (org.apache.hadoop.yarn.api.records.LocalResource)5 NodeReport (org.apache.hadoop.yarn.api.records.NodeReport)5 YarnClusterMetrics (org.apache.hadoop.yarn.api.records.YarnClusterMetrics)5 ByteArrayOutputStream (java.io.ByteArrayOutputStream)4 PrintWriter (java.io.PrintWriter)4 GetNewApplicationResponse (org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse)4 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)4 Priority (org.apache.hadoop.yarn.api.records.Priority)4 YarnClientApplication (org.apache.hadoop.yarn.client.api.YarnClientApplication)4 ByteBuffer (java.nio.ByteBuffer)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 FileSystem (org.apache.hadoop.fs.FileSystem)3 Path (org.apache.hadoop.fs.Path)3 DataOutputBuffer (org.apache.hadoop.io.DataOutputBuffer)3