Hadoop metrics via REST API: allocatedMB, allocatedVcores and runningContainers is always -1
If there are no running jobs on your cluster when you call the RM cluster apps API you are looking historical data. Based on the Hadoop code (QueueStatisticsPBImpl.java under hadoop-yarn-project/), -1 is used as a default value when the RM doesn't know the value of that item.
@Overridepublic long getAllocatedVCores() { QueueStatisticsProtoOrBuilder p = viaProto ? proto : builder; return (p.hasAllocatedVCores()) ? p.getAllocatedVCores() : -1;}
Since the other fields are values that would stored in the Job History Server (other than allocatedMB
, allocatedVCores
, and runningContainers
), they contain actual values.