java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptImpl
All Implemented Interfaces:
org.apache.hadoop.yarn.event.EventHandler<RMAppAttemptEvent>, Recoverable, RMAppAttempt

public class RMAppAttemptImpl extends Object implements RMAppAttempt, Recoverable
  • 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: RMAppAttempt
      Get the application attempt id for this RMAppAttempt.
      Specified by:
      getAppAttemptId in interface RMAppAttempt
      Returns:
      the ApplicationAttemptId for this RM attempt.
    • getSubmissionContext

      public org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext getSubmissionContext()
      Description copied from interface: RMAppAttempt
      The application submission context for this RMAppAttempt.
      Specified by:
      getSubmissionContext in interface RMAppAttempt
      Returns:
      the application submission context for this Application.
    • getFinalApplicationStatus

      public org.apache.hadoop.yarn.api.records.FinalApplicationStatus getFinalApplicationStatus()
      Description copied from interface: RMAppAttempt
      The final status set by the AM.
      Specified by:
      getFinalApplicationStatus in interface RMAppAttempt
      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

      public RMAppAttemptState getAppAttemptState()
      Description copied from interface: RMAppAttempt
      The state of the RMAppAttempt.
      Specified by:
      getAppAttemptState in interface RMAppAttempt
      Returns:
      the state RMAppAttemptState of this RMAppAttempt
    • getHost

      public String getHost()
      Description copied from interface: RMAppAttempt
      The host on which the RMAppAttempt is running/ran on.
      Specified by:
      getHost in interface RMAppAttempt
      Returns:
      the host on which the RMAppAttempt ran/is running on.
    • getRpcPort

      public int getRpcPort()
      Description copied from interface: RMAppAttempt
      The rpc port of the RMAppAttempt.
      Specified by:
      getRpcPort in interface RMAppAttempt
      Returns:
      the rpc port of the RMAppAttempt to which the clients can connect to.
    • getTrackingUrl

      public String getTrackingUrl()
      Description copied from interface: RMAppAttempt
      The url at which the status of the application attempt can be accessed.
      Specified by:
      getTrackingUrl in interface RMAppAttempt
      Returns:
      the url at which the status of the attempt can be accessed.
    • getOriginalTrackingUrl

      public String getOriginalTrackingUrl()
      Description copied from interface: RMAppAttempt
      The 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:
      getOriginalTrackingUrl in interface RMAppAttempt
      Returns:
      the url at which the status of the attempt can be accessed and is not fronted by a proxy.
    • getWebProxyBase

      public String getWebProxyBase()
      Description copied from interface: RMAppAttempt
      The base to be prepended to web URLs that are not relative, and the user has been checked.
      Specified by:
      getWebProxyBase in interface RMAppAttempt
      Returns:
      the base URL to be prepended to web URLs that are not relative.
    • getClientTokenMasterKey

      public SecretKey getClientTokenMasterKey()
      Description copied from interface: RMAppAttempt
      The 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:
      getClientTokenMasterKey in interface RMAppAttempt
      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: RMAppAttempt
      The AMRMToken belonging to this app attempt
      Specified by:
      getAMRMToken in interface RMAppAttempt
      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: RMAppAttempt
      Create a token for authenticating a client connection to the app attempt
      Specified by:
      createClientToken in interface RMAppAttempt
      Parameters:
      client - the name of the client requesting the token
      Returns:
      the token or null if the attempt is not running
    • getDiagnostics

      public String getDiagnostics()
      Description copied from interface: RMAppAttempt
      Diagnostics information for the application attempt.
      Specified by:
      getDiagnostics in interface RMAppAttempt
      Returns:
      diagnostics information for the application attempt.
    • getAMContainerExitStatus

      public int getAMContainerExitStatus()
    • getProgress

      public float getProgress()
      Description copied from interface: RMAppAttempt
      Progress for the application attempt.
      Specified by:
      getProgress in interface RMAppAttempt
      Returns:
      the progress for this RMAppAttempt
    • getJustFinishedContainers

      @VisibleForTesting public List<org.apache.hadoop.yarn.api.records.ContainerStatus> getJustFinishedContainers()
      Description copied from interface: RMAppAttempt
      Return the list of last set of finished containers. This does not reset the finished containers.
      Specified by:
      getJustFinishedContainers in interface RMAppAttempt
      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: RMAppAttempt
      Returns a reference to the map of last set of finished containers to the corresponding node. This does not reset the finished containers.
      Specified by:
      getJustFinishedContainersReference in interface RMAppAttempt
      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: RMAppAttempt
      The map of conatiners per Node that are already sent to the AM.
      Specified by:
      getFinishedContainersSentToAMReference in interface RMAppAttempt
      Returns:
      map of per node list of finished container status sent to AM
    • pullJustFinishedContainers

      public List<org.apache.hadoop.yarn.api.records.ContainerStatus> pullJustFinishedContainers()
      Description copied from interface: RMAppAttempt
      Return a list of the last set of finished containers, resetting the finished containers to empty.
      Specified by:
      pullJustFinishedContainers in interface RMAppAttempt
      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: RMAppAttempt
      The container on which the Application Master is running.
      Specified by:
      getMasterContainer in interface RMAppAttempt
      Returns:
      the Container on which the application master is running.
    • setMasterContainer

      @Private @VisibleForTesting public void setMasterContainer(org.apache.hadoop.yarn.api.records.Container container)
    • handle

      public void handle(RMAppAttemptEvent event)
      Specified by:
      handle in interface org.apache.hadoop.yarn.event.EventHandler<RMAppAttemptEvent>
    • getApplicationResourceUsageReport

      public org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport getApplicationResourceUsageReport()
      Description copied from interface: RMAppAttempt
      Get application container and resource usage information.
      Specified by:
      getApplicationResourceUsageReport in interface RMAppAttempt
      Returns:
      an ApplicationResourceUsageReport object.
    • recover

      public void recover(RMStateStore.RMState state)
      Specified by:
      recover in interface Recoverable
    • transferStateFromAttempt

      public void transferStateFromAttempt(RMAppAttempt attempt)
    • shouldCountTowardsMaxAttemptRetry

      public boolean shouldCountTowardsMaxAttemptRetry()
      Description copied from interface: RMAppAttempt
      Return 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:
      shouldCountTowardsMaxAttemptRetry in interface RMAppAttempt
      Returns:
      attempt retry count.
    • getAMBlacklistManager

      public BlacklistManager getAMBlacklistManager()
      Description copied from interface: RMAppAttempt
      Get the BlacklistManager that manages blacklists for AM failures
      Specified by:
      getAMBlacklistManager in interface RMAppAttempt
      Returns:
      the BlacklistManager that tracks AM failures.
    • getStartTime

      public long getStartTime()
      Description copied from interface: RMAppAttempt
      the start time of the application.
      Specified by:
      getStartTime in interface RMAppAttempt
      Returns:
      the start time of the application.
    • getState

      public RMAppAttemptState getState()
      Description copied from interface: RMAppAttempt
      The current state of the RMAppAttempt.
      Specified by:
      getState in interface RMAppAttempt
      Returns:
      the current state RMAppAttemptState for this application attempt.
    • getPreviousState

      public RMAppAttemptState getPreviousState()
      Description copied from interface: RMAppAttempt
      The previous state of the RMAppAttempt before the current state.
      Specified by:
      getPreviousState in interface RMAppAttempt
      Returns:
      the previous state of the RMAppAttempt before the current state for this application attempt.
    • createApplicationAttemptState

      public org.apache.hadoop.yarn.api.records.YarnApplicationAttemptState createApplicationAttemptState()
      Description copied from interface: RMAppAttempt
      Create the external user-facing state of the attempt of ApplicationMaster from the current state of the RMAppAttempt.
      Specified by:
      createApplicationAttemptState in interface RMAppAttempt
      Returns:
      the external user-facing state of the attempt ApplicationMaster.
    • createApplicationAttemptReport

      public org.apache.hadoop.yarn.api.records.ApplicationAttemptReport createApplicationAttemptReport()
      Description copied from interface: RMAppAttempt
      Create the Application attempt report from the RMAppAttempt
      Specified by:
      createApplicationAttemptReport in interface RMAppAttempt
      Returns:
      ApplicationAttemptReport
    • getRMAppAttemptMetrics

      public RMAppAttemptMetrics getRMAppAttemptMetrics()
      Description copied from interface: RMAppAttempt
      Get metrics from the RMAppAttempt
      Specified by:
      getRMAppAttemptMetrics in interface RMAppAttempt
      Returns:
      metrics
    • getFinishTime

      public long getFinishTime()
      Description copied from interface: RMAppAttempt
      the finish time of the application attempt.
      Specified by:
      getFinishTime in interface RMAppAttempt
      Returns:
      the finish time of the application attempt.
    • updateAMLaunchDiagnostics

      public void updateAMLaunchDiagnostics(String amLaunchDiagnostics)
      Description copied from interface: RMAppAttempt
      To capture Launch diagnostics of the app.
      Specified by:
      updateAMLaunchDiagnostics in interface RMAppAttempt
      Parameters:
      amLaunchDiagnostics - amLaunchDiagnostics.
    • getRecoveredFinalState

      public RMAppAttemptState getRecoveredFinalState()
    • setRecoveredFinalState

      public void setRecoveredFinalState(RMAppAttemptState finalState)
    • getBlacklistedNodes

      public Set<String> getBlacklistedNodes()
      Specified by:
      getBlacklistedNodes in interface RMAppAttempt
      Returns:
      Set of nodes which are blacklisted by the application
    • onInvalidTranstion

      protected void onInvalidTranstion(RMAppAttemptEventType rmAppAttemptEventType, RMAppAttemptState state)