Class QueueMetrics
java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.scheduler.QueueMetrics
- All Implemented Interfaces:
org.apache.hadoop.metrics2.MetricsSource
- Direct Known Subclasses:
CSQueueMetrics,FSQueueMetrics,PartitionQueueMetrics
@Private
@Metrics(context="yarn")
public class QueueMetrics
extends Object
implements org.apache.hadoop.metrics2.MetricsSource
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.apache.hadoop.conf.Configurationstatic final Stringstatic final Stringstatic final Stringprotected final org.apache.hadoop.metrics2.MetricsSystemprotected static final org.apache.hadoop.metrics2.MetricsInfoprotected static final org.apache.hadoop.metrics2.MetricsInfoprotected static final org.apache.hadoop.metrics2.MetricsInfoprotected final Stringprotected final org.apache.hadoop.metrics2.lib.MetricsRegistryprotected static final org.apache.hadoop.metrics2.MetricsInfoprotected final Map<String,QueueMetrics> -
Constructor Summary
ConstructorsConstructorDescriptionQueueMetrics(org.apache.hadoop.metrics2.MetricsSystem ms, String queueName, Queue parent, boolean enableUserMetrics, org.apache.hadoop.conf.Configuration conf) -
Method Summary
Modifier and TypeMethodDescriptionvoidactivateApp(String user) voidaddAppAttemptFirstContainerAllocationDelay(long latency) voidallocateResources(String partition, String user, int containers, org.apache.hadoop.yarn.api.records.Resource res, boolean decrPending) voidallocateResources(String partition, String user, org.apache.hadoop.yarn.api.records.Resource res) Allocate Resource for container size change.static voidHelper method to clear cache.protected voidvoiddeactivateApp(String user) voidvoiddecrPendingResources(String partition, String user, int containers, org.apache.hadoop.yarn.api.records.Resource res) voiddecrReserveResource(org.apache.hadoop.yarn.api.records.Resource res) voidfillInValuesFromAvailableResources(org.apache.hadoop.yarn.api.records.Resource fromResource, org.apache.hadoop.yarn.api.records.Resource targetResource) Fills in Resource values from available metrics values of custom resources to @code{targetResource}, only if the corresponding value of @code{targetResource} is zero.voidfinishApp(String user, RMAppState rmAppFinalState, boolean unmanagedAM) voidfinishAppAttempt(org.apache.hadoop.yarn.api.records.ApplicationId appId, boolean isPending, String user, boolean unmanagedAM) static QueueMetricsforQueue(String queueName, Queue parent, boolean enableUserMetrics, org.apache.hadoop.conf.Configuration conf) static QueueMetricsforQueue(org.apache.hadoop.metrics2.MetricsSystem ms, String queueName, Queue parent, boolean enableUserMetrics, org.apache.hadoop.conf.Configuration conf) intintlonglongorg.apache.hadoop.yarn.metrics.CustomResourceMetricValueHandle this specially as this has a long value and it could be truncated when casted into an int parameter of Resource.newInstance (vCores).longorg.apache.hadoop.metrics2.lib.MutableCounterLonglonglonglonglongorg.apache.hadoop.metrics2.lib.MutableCounterLonglongintlongorg.apache.hadoop.yarn.api.records.Resourceintintintintintintintlongorg.apache.hadoop.yarn.api.records.ResourceintvoidgetMetrics(org.apache.hadoop.metrics2.MetricsCollector collector, boolean all) org.apache.hadoop.metrics2.MetricsSystemgetPartitionQueueMetrics(String partition) Partition * Queue Metrics Computes Metrics at Partition (Node Label) * Queue Level.intlongorg.apache.hadoop.yarn.api.records.Resourceintstatic Map<String,QueueMetrics> Returns the metrics cache to help prevent re-registrations.intlongorg.apache.hadoop.yarn.api.records.ResourceintintintintintintgetUserMetrics(String userName) voidvoidincrNodeTypeAggregations(String user, NodeType type) voidincrPendingResources(String partition, String user, int containers, org.apache.hadoop.yarn.api.records.Resource res) Increment pending resource metricsvoidincrReserveResources(org.apache.hadoop.yarn.api.records.Resource res) voidinternalAllocateResources(String partition, String user, int containers, org.apache.hadoop.yarn.api.records.Resource res, boolean decrPending) protected voidinternalDecrPendingResources(String partition, String user, int containers, org.apache.hadoop.yarn.api.records.Resource res) voidinternalIncrPendingResources(String partition, String user, int containers, org.apache.hadoop.yarn.api.records.Resource res) voidinternalReleaseResources(String partition, String user, int containers, org.apache.hadoop.yarn.api.records.Resource res) protected voidinternalReserveResources(String partition, String user, org.apache.hadoop.yarn.api.records.Resource res) protected voidinternalUnReserveResources(String partition, String user, org.apache.hadoop.yarn.api.records.Resource res) static booleanisConfigurationValidationSet(org.apache.hadoop.conf.Configuration conf) Check whether we are in a configuration validation mode.voidmoveAppFrom(AppSchedulingInfo app, boolean unmanagedAM) voidmoveAppTo(AppSchedulingInfo app, boolean unmanagedAM) voidprotected voidprotected voidregisterPartitionMetricsCreation(String metricName) voidreleaseResources(String partition, String user, int containers, org.apache.hadoop.yarn.api.records.Resource res) voidreserveResource(String partition, String user, org.apache.hadoop.yarn.api.records.Resource res) voidrunAppAttempt(org.apache.hadoop.yarn.api.records.ApplicationId appId, String user, boolean unmanagedAM) voidsetAvailableResources(org.apache.hadoop.yarn.api.records.Resource limit) Set Available resources with support for resource vectors.voidsetAvailableResourcesToQueue(String partition, org.apache.hadoop.yarn.api.records.Resource limit) Set available resources.voidsetAvailableResourcesToQueue(org.apache.hadoop.yarn.api.records.Resource limit) Set available resources.voidsetAvailableResourcesToUser(String partition, String user, org.apache.hadoop.yarn.api.records.Resource limit) Set available resources.static voidsetConfigurationValidation(org.apache.hadoop.conf.Configuration conf, boolean value) Set configuration validation mode.voidsetParent(QueueMetrics parent) voidsetParentQueue(Queue parentQueue) protected voidprotected static StringBuildersourceName(String queueName) voidvoidsubmitAppAttempt(String user, boolean unmanagedAM) protected QueueMetricsvoidunreserveResource(String partition, String user, org.apache.hadoop.yarn.api.records.Resource res) voidupdatePreemptedForCustomResources(org.apache.hadoop.yarn.api.records.Resource res) voidupdatePreemptedMemoryMBSeconds(long mbSeconds) voidupdatePreemptedResources(org.apache.hadoop.yarn.api.records.Resource res) voidupdatePreemptedSecondsForCustomResources(org.apache.hadoop.yarn.api.records.Resource res, long seconds) voidupdatePreemptedVcoreSeconds(long vcoreSeconds)
-
Field Details
-
QUEUE_INFO
protected static final org.apache.hadoop.metrics2.MetricsInfo QUEUE_INFO -
USER_INFO
protected static final org.apache.hadoop.metrics2.MetricsInfo USER_INFO -
PARTITION_INFO
protected static final org.apache.hadoop.metrics2.MetricsInfo PARTITION_INFO -
registry
protected final org.apache.hadoop.metrics2.lib.MetricsRegistry registry -
queueName
-
metricsSystem
protected final org.apache.hadoop.metrics2.MetricsSystem metricsSystem -
users
-
conf
protected final org.apache.hadoop.conf.Configuration conf -
P_RECORD_INFO
protected static final org.apache.hadoop.metrics2.MetricsInfo P_RECORD_INFO -
DEFAULT_PARTITION
- See Also:
-
DEFAULT_PARTITION_JMX_STR
- See Also:
-
METRIC_NAME_DELIMITER
- See Also:
-
storedPartitionMetrics
-
-
Constructor Details
-
QueueMetrics
-
-
Method Details
-
tag
-
sourceName
-
forQueue
public static QueueMetrics forQueue(String queueName, Queue parent, boolean enableUserMetrics, org.apache.hadoop.conf.Configuration conf) -
clearQueueMetrics
@Private public static void clearQueueMetrics()Helper method to clear cache. -
getQueueMetrics
Returns the metrics cache to help prevent re-registrations.- Returns:
- A string to
QueueMetricsmap.
-
forQueue
public static QueueMetrics forQueue(org.apache.hadoop.metrics2.MetricsSystem ms, String queueName, Queue parent, boolean enableUserMetrics, org.apache.hadoop.conf.Configuration conf) -
getUserMetrics
-
getPartitionQueueMetrics
Partition * Queue Metrics Computes Metrics at Partition (Node Label) * Queue Level. Sample JMX O/P Structure: PartitionQueueMetrics (labelX) QueueMetrics (A) metrics QueueMetrics (A1) metrics QueueMetrics (A2) metrics QueueMetrics (B) metrics- Parameters:
partition- Node Partition- Returns:
- QueueMetrics
-
isConfigurationValidationSet
public static boolean isConfigurationValidationSet(org.apache.hadoop.conf.Configuration conf) Check whether we are in a configuration validation mode. INTERNAL ONLY.- Parameters:
conf- the configuration to check- Returns:
- true if
-
setConfigurationValidation
public static void setConfigurationValidation(org.apache.hadoop.conf.Configuration conf, boolean value) Set configuration validation mode. INTERNAL ONLY.- Parameters:
conf- the configuration to updatevalue- the value for the validation mode
-
getMetrics
public void getMetrics(org.apache.hadoop.metrics2.MetricsCollector collector, boolean all) - Specified by:
getMetricsin interfaceorg.apache.hadoop.metrics2.MetricsSource
-
submitApp
-
submitAppAttempt
-
runAppAttempt
public void runAppAttempt(org.apache.hadoop.yarn.api.records.ApplicationId appId, String user, boolean unmanagedAM) -
finishAppAttempt
public void finishAppAttempt(org.apache.hadoop.yarn.api.records.ApplicationId appId, boolean isPending, String user, boolean unmanagedAM) -
finishApp
-
moveAppFrom
-
moveAppTo
-
setAvailableResourcesToQueue
public void setAvailableResourcesToQueue(String partition, org.apache.hadoop.yarn.api.records.Resource limit) Set available resources. To be called by scheduler periodically as resources become available.- Parameters:
partition- Node Partitionlimit- resource limit
-
setAvailableResources
public void setAvailableResources(org.apache.hadoop.yarn.api.records.Resource limit) Set Available resources with support for resource vectors.- Parameters:
limit- Resource.
-
setAvailableResourcesToQueue
public void setAvailableResourcesToQueue(org.apache.hadoop.yarn.api.records.Resource limit) Set available resources. To be called by scheduler periodically as resources become available.- Parameters:
limit- resource limit
-
setAvailableResourcesToUser
public void setAvailableResourcesToUser(String partition, String user, org.apache.hadoop.yarn.api.records.Resource limit) Set available resources. To be called by scheduler periodically as resources become available.- Parameters:
partition- Node Partitionuser- Name of the user.limit- resource limit
-
incrPendingResources
public void incrPendingResources(String partition, String user, int containers, org.apache.hadoop.yarn.api.records.Resource res) Increment pending resource metrics- Parameters:
partition- Node Partitionuser- Name of the user.containers- containers count.res- the TOTAL delta of resources note this is different from the other APIs which use per container resource
-
internalIncrPendingResources
-
createQueueMetricsForCustomResources
protected void createQueueMetricsForCustomResources() -
registerCustomResources
protected void registerCustomResources() -
decrPendingResources
-
internalDecrPendingResources
-
incrNodeTypeAggregations
-
allocateResources
-
internalAllocateResources
-
allocateResources
public void allocateResources(String partition, String user, org.apache.hadoop.yarn.api.records.Resource res) Allocate Resource for container size change.- Parameters:
partition- Node Partitionuser- Name of the userres- Resource.
-
releaseResources
-
internalReleaseResources
-
preemptContainer
public void preemptContainer() -
updatePreemptedMemoryMBSeconds
public void updatePreemptedMemoryMBSeconds(long mbSeconds) -
updatePreemptedVcoreSeconds
public void updatePreemptedVcoreSeconds(long vcoreSeconds) -
updatePreemptedResources
public void updatePreemptedResources(org.apache.hadoop.yarn.api.records.Resource res) -
updatePreemptedForCustomResources
public void updatePreemptedForCustomResources(org.apache.hadoop.yarn.api.records.Resource res) -
updatePreemptedSecondsForCustomResources
public void updatePreemptedSecondsForCustomResources(org.apache.hadoop.yarn.api.records.Resource res, long seconds) -
reserveResource
-
internalReserveResources
-
incrReserveResources
public void incrReserveResources(org.apache.hadoop.yarn.api.records.Resource res) -
unreserveResource
-
internalUnReserveResources
-
decrReserveResource
public void decrReserveResource(org.apache.hadoop.yarn.api.records.Resource res) -
incrActiveUsers
public void incrActiveUsers() -
decrActiveUsers
public void decrActiveUsers() -
activateApp
-
deactivateApp
-
addAppAttemptFirstContainerAllocationDelay
public void addAppAttemptFirstContainerAllocationDelay(long latency) -
getAppsSubmitted
public int getAppsSubmitted() -
getUnmanagedAppsSubmitted
public int getUnmanagedAppsSubmitted() -
getAppsRunning
public int getAppsRunning() -
getUnmanagedAppsRunning
public int getUnmanagedAppsRunning() -
getAppsPending
public int getAppsPending() -
getUnmanagedAppsPending
public int getUnmanagedAppsPending() -
getAppsCompleted
public int getAppsCompleted() -
getUnmanagedAppsCompleted
public int getUnmanagedAppsCompleted() -
getAppsKilled
public int getAppsKilled() -
getAppsFailed
public int getAppsFailed() -
getUnmanagedAppsFailed
public int getUnmanagedAppsFailed() -
getAllocatedResources
public org.apache.hadoop.yarn.api.records.Resource getAllocatedResources() -
getAvailableResources
public org.apache.hadoop.yarn.api.records.Resource getAvailableResources() -
getPendingResources
public org.apache.hadoop.yarn.api.records.Resource getPendingResources() -
getReservedResources
public org.apache.hadoop.yarn.api.records.Resource getReservedResources() -
getAggregatedPreemptedSecondsResources
@VisibleForTesting public org.apache.hadoop.yarn.metrics.CustomResourceMetricValue getAggregatedPreemptedSecondsResources()Handle this specially as this has a long value and it could be truncated when casted into an int parameter of Resource.newInstance (vCores).- Returns:
- QueueMetricsCustomResource
-
getAggregateMemoryMBSecondsPreempted
@VisibleForTesting public org.apache.hadoop.metrics2.lib.MutableCounterLong getAggregateMemoryMBSecondsPreempted() -
getAggregateVcoreSecondsPreempted
@VisibleForTesting public org.apache.hadoop.metrics2.lib.MutableCounterLong getAggregateVcoreSecondsPreempted() -
getAggregateMemoryMBPreempted
@VisibleForTesting public long getAggregateMemoryMBPreempted() -
getAggregateVcoresPreempted
@VisibleForTesting public long getAggregateVcoresPreempted() -
getAllocatedMB
public long getAllocatedMB() -
getAllocatedVirtualCores
public int getAllocatedVirtualCores() -
getAllocatedContainers
public int getAllocatedContainers() -
getAvailableMB
public long getAvailableMB() -
getAvailableVirtualCores
public int getAvailableVirtualCores() -
getPendingMB
public long getPendingMB() -
getPendingVirtualCores
public int getPendingVirtualCores() -
getPendingContainers
public int getPendingContainers() -
getReservedMB
public long getReservedMB() -
getReservedVirtualCores
public int getReservedVirtualCores() -
getReservedContainers
public int getReservedContainers() -
getActiveUsers
public int getActiveUsers() -
getActiveApps
public int getActiveApps() -
getMetricsSystem
public org.apache.hadoop.metrics2.MetricsSystem getMetricsSystem() -
getAggregateAllocatedContainers
public long getAggregateAllocatedContainers() -
getAggregateNodeLocalContainersAllocated
public long getAggregateNodeLocalContainersAllocated() -
getAggregateRackLocalContainersAllocated
public long getAggregateRackLocalContainersAllocated() -
getAggregateOffSwitchContainersAllocated
public long getAggregateOffSwitchContainersAllocated() -
getAggegatedReleasedContainers
public long getAggegatedReleasedContainers() -
getAggregatePreemptedContainers
public long getAggregatePreemptedContainers() -
fillInValuesFromAvailableResources
public void fillInValuesFromAvailableResources(org.apache.hadoop.yarn.api.records.Resource fromResource, org.apache.hadoop.yarn.api.records.Resource targetResource) Fills in Resource values from available metrics values of custom resources to @code{targetResource}, only if the corresponding value of @code{targetResource} is zero. If @code{fromResource} has a value less than the available metrics value for a particular resource, it will be set to the @code{targetResource} instead.- Parameters:
fromResource- The resource to compare available resource values with.targetResource- The resource to save the values into.
-
getQueueMetricsForCustomResources
-
setQueueMetricsForCustomResources
-
setParent
-
getParentQueue
-
registerPartitionMetricsCreation
-
setParentQueue
-