Class RMAppAttemptImpl
java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptImpl
- All Implemented Interfaces:
org.apache.hadoop.yarn.event.EventHandler<RMAppAttemptEvent>,Recoverable,RMAppAttempt
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.apache.hadoop.yarn.api.records.Priority -
Constructor Summary
ConstructorsConstructorDescriptionRMAppAttemptImpl(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId, RMContext rmContext, YarnScheduler scheduler, ApplicationMasterService masterService, org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext submissionContext, org.apache.hadoop.conf.Configuration conf, List<org.apache.hadoop.yarn.api.records.ResourceRequest> amReqs, RMApp rmApp) RMAppAttemptImpl(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId, RMContext rmContext, YarnScheduler scheduler, ApplicationMasterService masterService, org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext submissionContext, org.apache.hadoop.conf.Configuration conf, List<org.apache.hadoop.yarn.api.records.ResourceRequest> amReqs, RMApp rmApp, BlacklistManager amBlacklistManager) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.hadoop.yarn.api.records.ApplicationAttemptReportCreate the Application attempt report from theRMAppAttemptorg.apache.hadoop.yarn.api.records.YarnApplicationAttemptStateCreate the external user-facing state of the attempt of ApplicationMaster from the current state of theRMAppAttempt.org.apache.hadoop.security.token.Token<org.apache.hadoop.yarn.security.client.ClientToAMTokenIdentifier>createClientToken(String client) Create a token for authenticating a client connection to the app attemptGet theBlacklistManagerthat manages blacklists for AM failuresintorg.apache.hadoop.security.token.Token<org.apache.hadoop.yarn.security.AMRMTokenIdentifier>The AMRMToken belonging to this app attemptintorg.apache.hadoop.yarn.api.records.ApplicationAttemptIdGet the application attempt id for thisRMAppAttempt.The state of theRMAppAttempt.org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReportGet application container and resource usage information.The master key for client-to-AM tokens for this app attempt.Diagnostics information for the application attempt.org.apache.hadoop.yarn.api.records.FinalApplicationStatusThe final status set by the AM.ConcurrentMap<org.apache.hadoop.yarn.api.records.NodeId,List<org.apache.hadoop.yarn.api.records.ContainerStatus>> The map of conatiners per Node that are already sent to the AM.longthe finish time of the application attempt.getHost()The host on which theRMAppAttemptis running/ran on.List<org.apache.hadoop.yarn.api.records.ContainerStatus>Return the list of last set of finished containers.ConcurrentMap<org.apache.hadoop.yarn.api.records.NodeId,List<org.apache.hadoop.yarn.api.records.ContainerStatus>> Returns a reference to the map of last set of finished containers to the corresponding node.org.apache.hadoop.yarn.api.records.ContainerThe container on which the Application Master is running.The original url at which the status of the application attempt can be accessed.The previous state of theRMAppAttemptbefore the current state.floatProgress for the application attempt.Get metrics from theRMAppAttemptintThe rpc port of theRMAppAttempt.longthe start time of the application.getState()The current state of theRMAppAttempt.org.apache.hadoop.yarn.api.records.ApplicationSubmissionContextThe application submission context for thisRMAppAttempt.The url at which the status of the application attempt can be accessed.The base to be prepended to web URLs that are not relative, and the user has been checked.voidhandle(RMAppAttemptEvent event) protected voidonInvalidTranstion(RMAppAttemptEventType rmAppAttemptEventType, RMAppAttemptState state) List<org.apache.hadoop.yarn.api.records.ContainerStatus>Return a list of the last set of finished containers, resetting the finished containers to empty.voidrecover(RMStateStore.RMState state) voidsetAMRMToken(org.apache.hadoop.security.token.Token<org.apache.hadoop.yarn.security.AMRMTokenIdentifier> lastToken) voidsetMasterContainer(org.apache.hadoop.yarn.api.records.Container container) voidsetRecoveredFinalState(RMAppAttemptState finalState) booleanReturn the flag which indicates whether the attempt failure should be counted to attempt retry count.voidtransferStateFromAttempt(RMAppAttempt attempt) voidupdateAMLaunchDiagnostics(String amLaunchDiagnostics) To capture Launch diagnostics of the app.
-
Field Details
-
AM_CONTAINER_PRIORITY
public static final org.apache.hadoop.yarn.api.records.Priority AM_CONTAINER_PRIORITY
-
-
Constructor Details
-
RMAppAttemptImpl
public RMAppAttemptImpl(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId, RMContext rmContext, YarnScheduler scheduler, ApplicationMasterService masterService, org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext submissionContext, org.apache.hadoop.conf.Configuration conf, List<org.apache.hadoop.yarn.api.records.ResourceRequest> amReqs, RMApp rmApp) -
RMAppAttemptImpl
public RMAppAttemptImpl(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId, RMContext rmContext, YarnScheduler scheduler, ApplicationMasterService masterService, org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext submissionContext, org.apache.hadoop.conf.Configuration conf, List<org.apache.hadoop.yarn.api.records.ResourceRequest> amReqs, RMApp rmApp, BlacklistManager amBlacklistManager)
-
-
Method Details
-
getAppAttemptId
public org.apache.hadoop.yarn.api.records.ApplicationAttemptId getAppAttemptId()Description copied from interface:RMAppAttemptGet the application attempt id for thisRMAppAttempt.- Specified by:
getAppAttemptIdin interfaceRMAppAttempt- Returns:
- the
ApplicationAttemptIdfor this RM attempt.
-
getSubmissionContext
public org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext getSubmissionContext()Description copied from interface:RMAppAttemptThe application submission context for thisRMAppAttempt.- Specified by:
getSubmissionContextin interfaceRMAppAttempt- Returns:
- the application submission context for this Application.
-
getFinalApplicationStatus
public org.apache.hadoop.yarn.api.records.FinalApplicationStatus getFinalApplicationStatus()Description copied from interface:RMAppAttemptThe final status set by the AM.- Specified by:
getFinalApplicationStatusin interfaceRMAppAttempt- Returns:
- the final status that is set by the AM when unregistering itself. Can return a null if the AM has not unregistered itself.
-
getAppAttemptState
Description copied from interface:RMAppAttemptThe state of theRMAppAttempt.- Specified by:
getAppAttemptStatein interfaceRMAppAttempt- Returns:
- the state
RMAppAttemptStateof thisRMAppAttempt
-
getHost
Description copied from interface:RMAppAttemptThe host on which theRMAppAttemptis running/ran on.- Specified by:
getHostin interfaceRMAppAttempt- Returns:
- the host on which the
RMAppAttemptran/is running on.
-
getRpcPort
public int getRpcPort()Description copied from interface:RMAppAttemptThe rpc port of theRMAppAttempt.- Specified by:
getRpcPortin interfaceRMAppAttempt- Returns:
- the rpc port of the
RMAppAttemptto which the clients can connect to.
-
getTrackingUrl
Description copied from interface:RMAppAttemptThe url at which the status of the application attempt can be accessed.- Specified by:
getTrackingUrlin interfaceRMAppAttempt- Returns:
- the url at which the status of the attempt can be accessed.
-
getOriginalTrackingUrl
Description copied from interface:RMAppAttemptThe original url at which the status of the application attempt can be accessed. This url is not fronted by a proxy. This is only intended to be used by the proxy.- Specified by:
getOriginalTrackingUrlin interfaceRMAppAttempt- Returns:
- the url at which the status of the attempt can be accessed and is not fronted by a proxy.
-
getWebProxyBase
Description copied from interface:RMAppAttemptThe base to be prepended to web URLs that are not relative, and the user has been checked.- Specified by:
getWebProxyBasein interfaceRMAppAttempt- Returns:
- the base URL to be prepended to web URLs that are not relative.
-
getClientTokenMasterKey
Description copied from interface:RMAppAttemptThe master key for client-to-AM tokens for this app attempt. This is only used for RMStateStore. Normal operation must invoke the secret manager to get the key and not use the local key directly.- Specified by:
getClientTokenMasterKeyin interfaceRMAppAttempt- Returns:
- The master key for client-to-AM tokens for this app attempt
-
getAMRMToken
public org.apache.hadoop.security.token.Token<org.apache.hadoop.yarn.security.AMRMTokenIdentifier> getAMRMToken()Description copied from interface:RMAppAttemptThe AMRMToken belonging to this app attempt- Specified by:
getAMRMTokenin interfaceRMAppAttempt- Returns:
- The AMRMToken belonging to this app attempt
-
setAMRMToken
@Private public void setAMRMToken(org.apache.hadoop.security.token.Token<org.apache.hadoop.yarn.security.AMRMTokenIdentifier> lastToken) -
getAMRMTokenKeyId
@Private public int getAMRMTokenKeyId() -
createClientToken
public org.apache.hadoop.security.token.Token<org.apache.hadoop.yarn.security.client.ClientToAMTokenIdentifier> createClientToken(String client) Description copied from interface:RMAppAttemptCreate a token for authenticating a client connection to the app attempt- Specified by:
createClientTokenin interfaceRMAppAttempt- Parameters:
client- the name of the client requesting the token- Returns:
- the token or null if the attempt is not running
-
getDiagnostics
Description copied from interface:RMAppAttemptDiagnostics information for the application attempt.- Specified by:
getDiagnosticsin interfaceRMAppAttempt- Returns:
- diagnostics information for the application attempt.
-
getAMContainerExitStatus
public int getAMContainerExitStatus() -
getProgress
public float getProgress()Description copied from interface:RMAppAttemptProgress for the application attempt.- Specified by:
getProgressin interfaceRMAppAttempt- Returns:
- the progress for this
RMAppAttempt
-
getJustFinishedContainers
@VisibleForTesting public List<org.apache.hadoop.yarn.api.records.ContainerStatus> getJustFinishedContainers()Description copied from interface:RMAppAttemptReturn the list of last set of finished containers. This does not reset the finished containers.- Specified by:
getJustFinishedContainersin interfaceRMAppAttempt- Returns:
- the list of just finished containers
-
getJustFinishedContainersReference
public ConcurrentMap<org.apache.hadoop.yarn.api.records.NodeId,List<org.apache.hadoop.yarn.api.records.ContainerStatus>> getJustFinishedContainersReference()Description copied from interface:RMAppAttemptReturns a reference to the map of last set of finished containers to the corresponding node. This does not reset the finished containers.- Specified by:
getJustFinishedContainersReferencein interfaceRMAppAttempt- Returns:
- the list of just finished containers, this does not reset the finished containers.
-
getFinishedContainersSentToAMReference
public ConcurrentMap<org.apache.hadoop.yarn.api.records.NodeId,List<org.apache.hadoop.yarn.api.records.ContainerStatus>> getFinishedContainersSentToAMReference()Description copied from interface:RMAppAttemptThe map of conatiners per Node that are already sent to the AM.- Specified by:
getFinishedContainersSentToAMReferencein interfaceRMAppAttempt- Returns:
- map of per node list of finished container status sent to AM
-
pullJustFinishedContainers
Description copied from interface:RMAppAttemptReturn a list of the last set of finished containers, resetting the finished containers to empty.- Specified by:
pullJustFinishedContainersin interfaceRMAppAttempt- Returns:
- the list of just finished containers, re setting the finished containers.
-
getMasterContainer
public org.apache.hadoop.yarn.api.records.Container getMasterContainer()Description copied from interface:RMAppAttemptThe container on which the Application Master is running.- Specified by:
getMasterContainerin interfaceRMAppAttempt- Returns:
- the
Containeron which the application master is running.
-
setMasterContainer
@Private @VisibleForTesting public void setMasterContainer(org.apache.hadoop.yarn.api.records.Container container) -
handle
- Specified by:
handlein interfaceorg.apache.hadoop.yarn.event.EventHandler<RMAppAttemptEvent>
-
getApplicationResourceUsageReport
public org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport getApplicationResourceUsageReport()Description copied from interface:RMAppAttemptGet application container and resource usage information.- Specified by:
getApplicationResourceUsageReportin interfaceRMAppAttempt- Returns:
- an ApplicationResourceUsageReport object.
-
recover
- Specified by:
recoverin interfaceRecoverable
-
transferStateFromAttempt
-
shouldCountTowardsMaxAttemptRetry
public boolean shouldCountTowardsMaxAttemptRetry()Description copied from interface:RMAppAttemptReturn the flag which indicates whether the attempt failure should be counted to attempt retry count.There failure types should not be counted to attempt retry count:
- preempted by the scheduler.
- hardware failures, such as NM failing, lost NM and NM disk errors.
- killed by RM because of RM restart or failover.
- Specified by:
shouldCountTowardsMaxAttemptRetryin interfaceRMAppAttempt- Returns:
- attempt retry count.
-
getAMBlacklistManager
Description copied from interface:RMAppAttemptGet theBlacklistManagerthat manages blacklists for AM failures- Specified by:
getAMBlacklistManagerin interfaceRMAppAttempt- Returns:
- the
BlacklistManagerthat tracks AM failures.
-
getStartTime
public long getStartTime()Description copied from interface:RMAppAttemptthe start time of the application.- Specified by:
getStartTimein interfaceRMAppAttempt- Returns:
- the start time of the application.
-
getState
Description copied from interface:RMAppAttemptThe current state of theRMAppAttempt.- Specified by:
getStatein interfaceRMAppAttempt- Returns:
- the current state
RMAppAttemptStatefor this application attempt.
-
getPreviousState
Description copied from interface:RMAppAttemptThe previous state of theRMAppAttemptbefore the current state.- Specified by:
getPreviousStatein interfaceRMAppAttempt- Returns:
- the previous state of the
RMAppAttemptbefore the current state for this application attempt.
-
createApplicationAttemptState
public org.apache.hadoop.yarn.api.records.YarnApplicationAttemptState createApplicationAttemptState()Description copied from interface:RMAppAttemptCreate the external user-facing state of the attempt of ApplicationMaster from the current state of theRMAppAttempt.- Specified by:
createApplicationAttemptStatein interfaceRMAppAttempt- Returns:
- the external user-facing state of the attempt ApplicationMaster.
-
createApplicationAttemptReport
public org.apache.hadoop.yarn.api.records.ApplicationAttemptReport createApplicationAttemptReport()Description copied from interface:RMAppAttemptCreate the Application attempt report from theRMAppAttempt- Specified by:
createApplicationAttemptReportin interfaceRMAppAttempt- Returns:
ApplicationAttemptReport
-
getRMAppAttemptMetrics
Description copied from interface:RMAppAttemptGet metrics from theRMAppAttempt- Specified by:
getRMAppAttemptMetricsin interfaceRMAppAttempt- Returns:
- metrics
-
getFinishTime
public long getFinishTime()Description copied from interface:RMAppAttemptthe finish time of the application attempt.- Specified by:
getFinishTimein interfaceRMAppAttempt- Returns:
- the finish time of the application attempt.
-
updateAMLaunchDiagnostics
Description copied from interface:RMAppAttemptTo capture Launch diagnostics of the app.- Specified by:
updateAMLaunchDiagnosticsin interfaceRMAppAttempt- Parameters:
amLaunchDiagnostics- amLaunchDiagnostics.
-
getRecoveredFinalState
-
setRecoveredFinalState
-
getBlacklistedNodes
- Specified by:
getBlacklistedNodesin interfaceRMAppAttempt- Returns:
- Set of nodes which are blacklisted by the application
-
onInvalidTranstion
protected void onInvalidTranstion(RMAppAttemptEventType rmAppAttemptEventType, RMAppAttemptState state)
-