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;
}
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;
}
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;
}
Aggregations