Search in sources :

Example 1 with QueueStatistics

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

the class FSQueue method getQueueStatistics.

public QueueStatistics getQueueStatistics() {
    QueueStatistics stats = recordFactory.newRecordInstance(QueueStatistics.class);
    stats.setNumAppsSubmitted(getMetrics().getAppsSubmitted());
    stats.setNumAppsRunning(getMetrics().getAppsRunning());
    stats.setNumAppsPending(getMetrics().getAppsPending());
    stats.setNumAppsCompleted(getMetrics().getAppsCompleted());
    stats.setNumAppsKilled(getMetrics().getAppsKilled());
    stats.setNumAppsFailed(getMetrics().getAppsFailed());
    stats.setNumActiveUsers(getMetrics().getActiveUsers());
    stats.setAvailableMemoryMB(getMetrics().getAvailableMB());
    stats.setAllocatedMemoryMB(getMetrics().getAllocatedMB());
    stats.setPendingMemoryMB(getMetrics().getPendingMB());
    stats.setReservedMemoryMB(getMetrics().getReservedMB());
    stats.setAvailableVCores(getMetrics().getAvailableVirtualCores());
    stats.setAllocatedVCores(getMetrics().getAllocatedVirtualCores());
    stats.setPendingVCores(getMetrics().getPendingVirtualCores());
    stats.setReservedVCores(getMetrics().getReservedVirtualCores());
    return stats;
}
Also used : QueueStatistics(org.apache.hadoop.yarn.api.records.QueueStatistics)

Example 2 with QueueStatistics

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

the class AbstractCSQueue method getQueueStatistics.

public QueueStatistics getQueueStatistics() {
    // Deliberately doesn't use lock here, because this method will be invoked
    // from schedulerApplicationAttempt, to avoid deadlock, sacrifice
    // consistency here.
    // TODO, improve this
    QueueStatistics stats = recordFactory.newRecordInstance(QueueStatistics.class);
    stats.setNumAppsSubmitted(getMetrics().getAppsSubmitted());
    stats.setNumAppsRunning(getMetrics().getAppsRunning());
    stats.setNumAppsPending(getMetrics().getAppsPending());
    stats.setNumAppsCompleted(getMetrics().getAppsCompleted());
    stats.setNumAppsKilled(getMetrics().getAppsKilled());
    stats.setNumAppsFailed(getMetrics().getAppsFailed());
    stats.setNumActiveUsers(getMetrics().getActiveUsers());
    stats.setAvailableMemoryMB(getMetrics().getAvailableMB());
    stats.setAllocatedMemoryMB(getMetrics().getAllocatedMB());
    stats.setPendingMemoryMB(getMetrics().getPendingMB());
    stats.setReservedMemoryMB(getMetrics().getReservedMB());
    stats.setAvailableVCores(getMetrics().getAvailableVirtualCores());
    stats.setAllocatedVCores(getMetrics().getAllocatedVirtualCores());
    stats.setPendingVCores(getMetrics().getPendingVirtualCores());
    stats.setReservedVCores(getMetrics().getReservedVirtualCores());
    stats.setPendingContainers(getMetrics().getPendingContainers());
    stats.setAllocatedContainers(getMetrics().getAllocatedContainers());
    stats.setReservedContainers(getMetrics().getReservedContainers());
    return stats;
}
Also used : QueueStatistics(org.apache.hadoop.yarn.api.records.QueueStatistics)

Example 3 with QueueStatistics

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

the class TopCLI method getQueueMetrics.

protected QueueMetrics getQueueMetrics() {
    QueueMetrics queueMetrics = new QueueMetrics();
    List<QueueInfo> queuesInfo;
    if (queues.isEmpty()) {
        try {
            queuesInfo = client.getRootQueueInfos();
        } catch (Exception ie) {
            LOG.error("Unable to get queue information", ie);
            return queueMetrics;
        }
    } else {
        queuesInfo = new ArrayList<>();
        for (String queueName : queues) {
            try {
                QueueInfo qInfo = client.getQueueInfo(queueName);
                queuesInfo.add(qInfo);
            } catch (Exception ie) {
                LOG.error("Unable to get queue information", ie);
                return queueMetrics;
            }
        }
    }
    for (QueueInfo childInfo : queuesInfo) {
        QueueStatistics stats = childInfo.getQueueStatistics();
        if (stats != null) {
            queueMetrics.appsSubmitted += stats.getNumAppsSubmitted();
            queueMetrics.appsRunning += stats.getNumAppsRunning();
            queueMetrics.appsPending += stats.getNumAppsPending();
            queueMetrics.appsCompleted += stats.getNumAppsCompleted();
            queueMetrics.appsKilled += stats.getNumAppsKilled();
            queueMetrics.appsFailed += stats.getNumAppsFailed();
            queueMetrics.activeUsers += stats.getNumActiveUsers();
            queueMetrics.availableMemoryGB += stats.getAvailableMemoryMB();
            queueMetrics.allocatedMemoryGB += stats.getAllocatedMemoryMB();
            queueMetrics.pendingMemoryGB += stats.getPendingMemoryMB();
            queueMetrics.reservedMemoryGB += stats.getReservedMemoryMB();
            queueMetrics.availableVCores += stats.getAvailableVCores();
            queueMetrics.allocatedVCores += stats.getAllocatedVCores();
            queueMetrics.pendingVCores += stats.getPendingVCores();
            queueMetrics.reservedVCores += stats.getReservedVCores();
            queueMetrics.allocatedContainers += stats.getAllocatedContainers();
            queueMetrics.pendingContainers += stats.getPendingContainers();
            queueMetrics.reservedContainers += stats.getReservedContainers();
        }
    }
    queueMetrics.availableMemoryGB = queueMetrics.availableMemoryGB / 1024;
    queueMetrics.allocatedMemoryGB = queueMetrics.allocatedMemoryGB / 1024;
    queueMetrics.pendingMemoryGB = queueMetrics.pendingMemoryGB / 1024;
    queueMetrics.reservedMemoryGB = queueMetrics.reservedMemoryGB / 1024;
    return queueMetrics;
}
Also used : QueueInfo(org.apache.hadoop.yarn.api.records.QueueInfo) QueueStatistics(org.apache.hadoop.yarn.api.records.QueueStatistics) ParseException(org.apache.commons.cli.ParseException) YarnException(org.apache.hadoop.yarn.exceptions.YarnException) ConnectException(java.net.ConnectException) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) JSONException(org.codehaus.jettison.json.JSONException)

Aggregations

QueueStatistics (org.apache.hadoop.yarn.api.records.QueueStatistics)3 IOException (java.io.IOException)1 ConnectException (java.net.ConnectException)1 MalformedURLException (java.net.MalformedURLException)1 ParseException (org.apache.commons.cli.ParseException)1 QueueInfo (org.apache.hadoop.yarn.api.records.QueueInfo)1 YarnException (org.apache.hadoop.yarn.exceptions.YarnException)1 JSONException (org.codehaus.jettison.json.JSONException)1