use of alluxio.wire.BlockMasterInfo.BlockMasterInfoField in project alluxio by Alluxio.
the class SummaryCommand method printBlockMasterInfo.
/**
* Prints Alluxio block master information.
*/
private void printBlockMasterInfo() throws IOException {
Set<BlockMasterInfoField> blockMasterInfoFilter = new HashSet<>(Arrays.asList(BlockMasterInfoField.LIVE_WORKER_NUM, BlockMasterInfoField.LOST_WORKER_NUM, BlockMasterInfoField.CAPACITY_BYTES, BlockMasterInfoField.USED_BYTES, BlockMasterInfoField.FREE_BYTES, BlockMasterInfoField.CAPACITY_BYTES_ON_TIERS, BlockMasterInfoField.USED_BYTES_ON_TIERS));
BlockMasterInfo blockMasterInfo = mBlockMasterClient.getBlockMasterInfo(blockMasterInfoFilter);
print("Live Workers: " + blockMasterInfo.getLiveWorkerNum());
print("Lost Workers: " + blockMasterInfo.getLostWorkerNum());
print("Total Capacity: " + FormatUtils.getSizeFromBytes(blockMasterInfo.getCapacityBytes()));
mIndentationLevel++;
Map<String, Long> totalCapacityOnTiers = new TreeMap<>((a, b) -> (FileSystemAdminShellUtils.compareTierNames(a, b)));
totalCapacityOnTiers.putAll(blockMasterInfo.getCapacityBytesOnTiers());
for (Map.Entry<String, Long> capacityBytesTier : totalCapacityOnTiers.entrySet()) {
print("Tier: " + capacityBytesTier.getKey() + " Size: " + FormatUtils.getSizeFromBytes(capacityBytesTier.getValue()));
}
mIndentationLevel--;
print("Used Capacity: " + FormatUtils.getSizeFromBytes(blockMasterInfo.getUsedBytes()));
mIndentationLevel++;
Map<String, Long> usedCapacityOnTiers = new TreeMap<>((a, b) -> (FileSystemAdminShellUtils.compareTierNames(a, b)));
usedCapacityOnTiers.putAll(blockMasterInfo.getUsedBytesOnTiers());
for (Map.Entry<String, Long> usedBytesTier : usedCapacityOnTiers.entrySet()) {
print("Tier: " + usedBytesTier.getKey() + " Size: " + FormatUtils.getSizeFromBytes(usedBytesTier.getValue()));
}
mIndentationLevel--;
print("Free Capacity: " + FormatUtils.getSizeFromBytes(blockMasterInfo.getFreeBytes()));
}
Aggregations