org.apache.hadoop.yarn.server.resourcemanager.rmapp
Class RMAppImpl

java.lang.Object
  extended by org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppImpl
All Implemented Interfaces:
org.apache.hadoop.yarn.event.EventHandler<RMAppEvent>, Recoverable, RMApp

public class RMAppImpl
extends Object
implements RMApp, Recoverable


Constructor Summary
RMAppImpl(org.apache.hadoop.yarn.api.records.ApplicationId applicationId, RMContext rmContext, org.apache.hadoop.conf.Configuration config, String name, String user, String queue, org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext submissionContext, YarnScheduler scheduler, ApplicationMasterService masterService, long submitTime, String applicationType)
           
 
Method Summary
 org.apache.hadoop.yarn.api.records.ApplicationReport createAndGetApplicationReport(String clientUserName, boolean allowAccess)
          To get the status of an application in the RM, this method can be used.
 org.apache.hadoop.yarn.api.records.YarnApplicationState createApplicationState()
          Create the external user-facing state of ApplicationMaster from the current state of the RMApp.
 Map<org.apache.hadoop.yarn.api.records.ApplicationAttemptId,RMAppAttempt> getAppAttempts()
          RMApp can have multiple application attempts RMAppAttempt.
 org.apache.hadoop.yarn.api.records.ApplicationId getApplicationId()
          The application id for this RMApp.
 org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext getApplicationSubmissionContext()
          The application submission context for this RMApp
 String getApplicationType()
          Returns the application type
 RMAppAttempt getCurrentAppAttempt()
          RMApp can have multiple application attempts RMAppAttempt.
 StringBuilder getDiagnostics()
          the diagnostics information for the application master.
 org.apache.hadoop.yarn.api.records.FinalApplicationStatus getFinalApplicationStatus()
          The final finish state of the AM when unregistering as in FinishApplicationMasterRequest.setFinalApplicationStatus(FinalApplicationStatus).
 long getFinishTime()
          The finish time of the RMApp
 int getMaxAppAttempts()
          The number of max attempts of the application.
 String getName()
          The name of the application as set in ApplicationSubmissionContext.setApplicationName(String).
 float getProgress()
          Progress of application.
 String getQueue()
          Each Application is submitted to a queue decided by ApplicationSubmissionContext.setQueue(String).
 RMAppAttempt getRMAppAttempt(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId)
          RMApp can have multiple application attempts RMAppAttempt.
 long getStartTime()
          the start time of the application.
 RMAppState getState()
          The current state of the RMApp.
 long getSubmitTime()
          the submit time of the application.
 String getTrackingUrl()
          The tracking url for the application master.
 String getUser()
          The user who submitted this application.
 void handle(RMAppEvent event)
           
 boolean isAppSafeToUnregister()
          Check whether this application is safe to unregister.
 int pullRMNodeUpdates(Collection<RMNode> updatedNodes)
          To receive the collection of all RMNodes whose updates have been received by the RMApp.
 void recover(RMStateStore.RMState state)
           
 void setQueue(String queue)
          Reflects a change in the application's queue from the one specified in the ApplicationSubmissionContext.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RMAppImpl

public RMAppImpl(org.apache.hadoop.yarn.api.records.ApplicationId applicationId,
                 RMContext rmContext,
                 org.apache.hadoop.conf.Configuration config,
                 String name,
                 String user,
                 String queue,
                 org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext submissionContext,
                 YarnScheduler scheduler,
                 ApplicationMasterService masterService,
                 long submitTime,
                 String applicationType)
Method Detail

getApplicationId

public org.apache.hadoop.yarn.api.records.ApplicationId getApplicationId()
Description copied from interface: RMApp
The application id for this RMApp.

Specified by:
getApplicationId in interface RMApp
Returns:
the ApplicationId for this RMApp.

getApplicationSubmissionContext

public org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext getApplicationSubmissionContext()
Description copied from interface: RMApp
The application submission context for this RMApp

Specified by:
getApplicationSubmissionContext in interface RMApp
Returns:
the ApplicationSubmissionContext for this RMApp

getFinalApplicationStatus

public org.apache.hadoop.yarn.api.records.FinalApplicationStatus getFinalApplicationStatus()
Description copied from interface: RMApp
The final finish state of the AM when unregistering as in FinishApplicationMasterRequest.setFinalApplicationStatus(FinalApplicationStatus).

Specified by:
getFinalApplicationStatus in interface RMApp
Returns:
the final finish state of the AM as set in FinishApplicationMasterRequest.setFinalApplicationStatus(FinalApplicationStatus).

getState

public RMAppState getState()
Description copied from interface: RMApp
The current state of the RMApp.

Specified by:
getState in interface RMApp
Returns:
the current state RMAppState for this application.

getUser

public String getUser()
Description copied from interface: RMApp
The user who submitted this application.

Specified by:
getUser in interface RMApp
Returns:
the user who submitted the application.

getProgress

public float getProgress()
Description copied from interface: RMApp
Progress of application.

Specified by:
getProgress in interface RMApp
Returns:
the progress of the RMApp.

getRMAppAttempt

public RMAppAttempt getRMAppAttempt(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId)
Description copied from interface: RMApp
RMApp can have multiple application attempts RMAppAttempt. This method returns the RMAppAttempt corresponding to ApplicationAttemptId.

Specified by:
getRMAppAttempt in interface RMApp
Parameters:
appAttemptId - the application attempt id
Returns:
the RMAppAttempt corresponding to the ApplicationAttemptId.

getQueue

public String getQueue()
Description copied from interface: RMApp
Each Application is submitted to a queue decided by ApplicationSubmissionContext.setQueue(String). This method returns the queue to which an application was submitted.

Specified by:
getQueue in interface RMApp
Returns:
the queue to which the application was submitted to.

setQueue

public void setQueue(String queue)
Description copied from interface: RMApp
Reflects a change in the application's queue from the one specified in the ApplicationSubmissionContext.

Specified by:
setQueue in interface RMApp
Parameters:
queue - the new queue name

getName

public String getName()
Description copied from interface: RMApp
The name of the application as set in ApplicationSubmissionContext.setApplicationName(String).

Specified by:
getName in interface RMApp
Returns:
the name of the application.

getCurrentAppAttempt

public RMAppAttempt getCurrentAppAttempt()
Description copied from interface: RMApp
RMApp can have multiple application attempts RMAppAttempt. This method returns the current RMAppAttempt.

Specified by:
getCurrentAppAttempt in interface RMApp
Returns:
the current RMAppAttempt

getAppAttempts

public Map<org.apache.hadoop.yarn.api.records.ApplicationAttemptId,RMAppAttempt> getAppAttempts()
Description copied from interface: RMApp
RMApp can have multiple application attempts RMAppAttempt. This method returns the all RMAppAttempts for the RMApp.

Specified by:
getAppAttempts in interface RMApp
Returns:
all RMAppAttempts for the RMApp.

pullRMNodeUpdates

public int pullRMNodeUpdates(Collection<RMNode> updatedNodes)
Description copied from interface: RMApp
To receive the collection of all RMNodes whose updates have been received by the RMApp. Updates can be node becoming lost or becoming healthy etc. The method clears the information from the RMApp. So each call to this method gives the delta from the previous call.

Specified by:
pullRMNodeUpdates in interface RMApp
Parameters:
updatedNodes - Collection into which the updates are transferred
Returns:
the number of nodes added to the Collection

createAndGetApplicationReport

public org.apache.hadoop.yarn.api.records.ApplicationReport createAndGetApplicationReport(String clientUserName,
                                                                                          boolean allowAccess)
Description copied from interface: RMApp
To get the status of an application in the RM, this method can be used. If full access is not allowed then the following fields in the report will be stubbed:

Specified by:
createAndGetApplicationReport in interface RMApp
Parameters:
clientUserName - the user name of the client requesting the report
allowAccess - whether to allow full access to the report
Returns:
the ApplicationReport detailing the status of the application.

getFinishTime

public long getFinishTime()
Description copied from interface: RMApp
The finish time of the RMApp

Specified by:
getFinishTime in interface RMApp
Returns:
the finish time of the application.,

getStartTime

public long getStartTime()
Description copied from interface: RMApp
the start time of the application.

Specified by:
getStartTime in interface RMApp
Returns:
the start time of the application.

getSubmitTime

public long getSubmitTime()
Description copied from interface: RMApp
the submit time of the application.

Specified by:
getSubmitTime in interface RMApp
Returns:
the submit time of the application.

getTrackingUrl

public String getTrackingUrl()
Description copied from interface: RMApp
The tracking url for the application master.

Specified by:
getTrackingUrl in interface RMApp
Returns:
the tracking url for the application master.

getDiagnostics

public StringBuilder getDiagnostics()
Description copied from interface: RMApp
the diagnostics information for the application master.

Specified by:
getDiagnostics in interface RMApp
Returns:
the diagnostics information for the application master.

getMaxAppAttempts

public int getMaxAppAttempts()
Description copied from interface: RMApp
The number of max attempts of the application.

Specified by:
getMaxAppAttempts in interface RMApp
Returns:
the number of max attempts of the application.

handle

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

recover

public void recover(RMStateStore.RMState state)
             throws Exception
Specified by:
recover in interface Recoverable
Throws:
Exception

getApplicationType

public String getApplicationType()
Description copied from interface: RMApp
Returns the application type

Specified by:
getApplicationType in interface RMApp
Returns:
the application type.

isAppSafeToUnregister

public boolean isAppSafeToUnregister()
Description copied from interface: RMApp
Check whether this application is safe to unregister. An application is deemed to be safe to unregister if it is an unmanaged AM or its state has been removed from state store.

Specified by:
isAppSafeToUnregister in interface RMApp
Returns:
the flag which indicates whether this application is safe to unregister.

createApplicationState

public org.apache.hadoop.yarn.api.records.YarnApplicationState createApplicationState()
Description copied from interface: RMApp
Create the external user-facing state of ApplicationMaster from the current state of the RMApp.

Specified by:
createApplicationState in interface RMApp
Returns:
the external user-facing state of ApplicationMaster.


Copyright © 2014 Apache Software Foundation. All Rights Reserved.