Search in sources :

Example 6 with QueueInfo

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

the class AbstractCSQueue method getQueueInfo.

protected QueueInfo getQueueInfo() {
    // Deliberately doesn't use lock here, because this method will be invoked
    // from schedulerApplicationAttempt, to avoid deadlock, sacrifice
    // consistency here.
    // TODO, improve this
    QueueInfo queueInfo = recordFactory.newRecordInstance(QueueInfo.class);
    queueInfo.setQueueName(queueName);
    queueInfo.setAccessibleNodeLabels(accessibleLabels);
    queueInfo.setCapacity(queueCapacities.getCapacity());
    queueInfo.setMaximumCapacity(queueCapacities.getMaximumCapacity());
    queueInfo.setQueueState(getState());
    queueInfo.setDefaultNodeLabelExpression(defaultLabelExpression);
    queueInfo.setCurrentCapacity(getUsedCapacity());
    queueInfo.setQueueStatistics(getQueueStatistics());
    queueInfo.setPreemptionDisabled(preemptionDisabled);
    return queueInfo;
}
Also used : QueueInfo(org.apache.hadoop.yarn.api.records.QueueInfo)

Example 7 with QueueInfo

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

the class ParentQueue method getQueueInfo.

@Override
public QueueInfo getQueueInfo(boolean includeChildQueues, boolean recursive) {
    try {
        readLock.lock();
        QueueInfo queueInfo = getQueueInfo();
        List<QueueInfo> childQueuesInfo = new ArrayList<>();
        if (includeChildQueues) {
            for (CSQueue child : childQueues) {
                // Get queue information recursively?
                childQueuesInfo.add(child.getQueueInfo(recursive, recursive));
            }
        }
        queueInfo.setChildQueues(childQueuesInfo);
        return queueInfo;
    } finally {
        readLock.unlock();
    }
}
Also used : QueueInfo(org.apache.hadoop.yarn.api.records.QueueInfo) ArrayList(java.util.ArrayList)

Example 8 with QueueInfo

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

the class TestYarnCLI method testGetQueueInfoWithEmptyNodeLabel.

@Test
public void testGetQueueInfoWithEmptyNodeLabel() throws Exception {
    QueueCLI cli = createAndGetQueueCLI();
    QueueInfo queueInfo = QueueInfo.newInstance("queueA", 0.4f, 0.8f, 0.5f, null, null, QueueState.RUNNING, null, null, null, true);
    when(client.getQueueInfo(any(String.class))).thenReturn(queueInfo);
    int result = cli.run(new String[] { "-status", "queueA" });
    assertEquals(0, result);
    verify(client).getQueueInfo("queueA");
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintWriter pw = new PrintWriter(baos);
    pw.println("Queue Information : ");
    pw.println("Queue Name : " + "queueA");
    pw.println("\tState : " + "RUNNING");
    pw.println("\tCapacity : " + "40.0%");
    pw.println("\tCurrent Capacity : " + "50.0%");
    pw.println("\tMaximum Capacity : " + "80.0%");
    pw.println("\tDefault Node Label expression : " + NodeLabel.DEFAULT_NODE_LABEL_PARTITION);
    pw.println("\tAccessible Node Labels : ");
    pw.println("\tPreemption : " + "disabled");
    pw.close();
    String queueInfoStr = baos.toString("UTF-8");
    Assert.assertEquals(queueInfoStr, sysOutStream.toString());
}
Also used : QueueInfo(org.apache.hadoop.yarn.api.records.QueueInfo) ByteArrayOutputStream(java.io.ByteArrayOutputStream) PrintWriter(java.io.PrintWriter) Test(org.junit.Test)

Example 9 with QueueInfo

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

the class TestFifoScheduler method testFifoSchedulerCapacityWhenNoNMs.

@Test(timeout = 5000)
public void testFifoSchedulerCapacityWhenNoNMs() {
    FifoScheduler scheduler = new FifoScheduler();
    QueueInfo queueInfo = scheduler.getQueueInfo(null, false, false);
    Assert.assertEquals(0.0f, queueInfo.getCurrentCapacity(), 0.0f);
}
Also used : QueueInfo(org.apache.hadoop.yarn.api.records.QueueInfo) Test(org.junit.Test)

Example 10 with QueueInfo

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

the class TestSchedulerApplicationAttempt method createQueue.

private Queue createQueue(String name, Queue parent, float capacity) {
    QueueMetrics metrics = QueueMetrics.forQueue(name, parent, false, conf);
    QueueInfo queueInfo = QueueInfo.newInstance(name, capacity, 1.0f, 0, null, null, QueueState.RUNNING, null, "", null, false);
    ActiveUsersManager activeUsersManager = new ActiveUsersManager(metrics);
    Queue queue = mock(Queue.class);
    when(queue.getMetrics()).thenReturn(metrics);
    when(queue.getAbstractUsersManager()).thenReturn(activeUsersManager);
    when(queue.getQueueInfo(false, false)).thenReturn(queueInfo);
    return queue;
}
Also used : QueueInfo(org.apache.hadoop.yarn.api.records.QueueInfo)

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