Class RMAppImpl
java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppImpl
- All Implemented Interfaces:
org.apache.hadoop.yarn.event.EventHandler<RMAppEvent>,Recoverable,RMApp
-
Constructor Summary
ConstructorsConstructorDescriptionRMAppImpl(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, Set<String> applicationTags, List<org.apache.hadoop.yarn.api.records.ResourceRequest> amReqs) 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, Set<String> applicationTags, List<org.apache.hadoop.yarn.api.records.ResourceRequest> amReqs, ApplicationPlacementContext placementContext, long startTime) RMAppImpl(org.apache.hadoop.yarn.api.records.ApplicationId applicationId, RMContext rmContext, org.apache.hadoop.conf.Configuration config, String name, org.apache.hadoop.security.UserGroupInformation userUgi, String queue, org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext submissionContext, YarnScheduler scheduler, ApplicationMasterService masterService, long submitTime, String applicationType, Set<String> applicationTags, List<org.apache.hadoop.yarn.api.records.ResourceRequest> amReqs, ApplicationPlacementContext placementContext, long startTime) -
Method Summary
Modifier and TypeMethodDescriptionvoidaggregateLogReport(org.apache.hadoop.yarn.api.records.NodeId nodeId, org.apache.hadoop.yarn.server.api.protocolrecords.LogAggregationReport report) org.apache.hadoop.yarn.api.records.ApplicationReportcreateAndGetApplicationReport(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.YarnApplicationStateCreate the external user-facing state of ApplicationMaster from the current state of theRMApp.Return the node label expression of the AM container.List<org.apache.hadoop.yarn.api.records.ResourceRequest>Map<org.apache.hadoop.yarn.api.records.ApplicationAttemptId,RMAppAttempt> RMAppcan have multiple application attemptsRMAppAttempt.org.apache.hadoop.yarn.api.records.ApplicationIdThe application id for thisRMApp.Get the application -> queue placement contextorg.apache.hadoop.yarn.api.records.PriorityGet priority of the application.Get the application scheduling environment variables.org.apache.hadoop.yarn.api.records.ApplicationSubmissionContextThe application submission context for thisRMAppGet tags for the applicationReturns the application typeorg.apache.hadoop.ipc.CallerContextorg.apache.hadoop.yarn.server.api.records.AppCollectorDataThe timeline collector information for the application.org.apache.hadoop.yarn.api.records.CollectorInfoThe timeline collector information to be sent to AM.RMAppcan have multiple application attemptsRMAppAttempt.the diagnostics information for the application master.org.apache.hadoop.yarn.api.records.FinalApplicationStatusThe final finish state of the AM when unregistering as inFinishApplicationMasterRequest.setFinalApplicationStatus(FinalApplicationStatus).longThe finish time of theRMApplongThe launch time of the application.getLogAggregationFailureMessagesForNM(org.apache.hadoop.yarn.api.records.NodeId nodeId) Map<org.apache.hadoop.yarn.api.records.NodeId,org.apache.hadoop.yarn.server.api.protocolrecords.LogAggregationReport> org.apache.hadoop.yarn.api.records.LogAggregationStatusintThe number of max attempts of the application.getName()The name of the application as set inApplicationSubmissionContext.setApplicationName(String).intintThe original tracking url for the application master.floatProgress of application.getQueue()Each Application is submitted to a queue decided byApplicationSubmissionContext.setQueue(String).Set<org.apache.hadoop.yarn.api.records.NodeId>Nodes on which the containers for thisRMAppran.org.apache.hadoop.yarn.api.records.ReservationIdgetRMAppAttempt(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId) RMAppcan have multiple application attemptsRMAppAttempt.Get RMAppMetrics of theRMApp.longthe start time of the application.getState()The current state of theRMApp.longthe submit time of the application.The tracking url for the application master.getUser()The user who submitted this application.voidhandle(RMAppEvent event) booleanCheck whether this application's state has been saved to the state store.booleanTo verify whether app has reached in its completing/completed states.static booleanisAppInFinalState(RMApp rmApp) protected voidonInvalidStateTransition(RMAppEventType rmAppEventType, RMAppState state) catch the InvalidStateTransition.intpullRMNodeUpdates(Map<RMNode, org.apache.hadoop.yarn.api.records.NodeUpdateType> upNodes) To receive the collection of allRMNodes whose updates have been received by the RMApp.voidrecover(RMStateStore.RMState state) voidvoidsetApplicationPriority(org.apache.hadoop.yarn.api.records.Priority applicationPriority) voidsetCollectorData(org.apache.hadoop.yarn.server.api.records.AppCollectorData incomingData) voidReflects a change in the application's queue from the one specified in theApplicationSubmissionContext.voidsetSystemClock(org.apache.hadoop.yarn.util.Clock clock) voidStarts the application level timeline collector for this app.voidStops the application level timeline collector for this app.voidupdateApplicationTimeout(Map<org.apache.hadoop.yarn.api.records.ApplicationTimeoutType, Long> updateTimeout)
-
Constructor Details
-
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, Set<String> applicationTags, List<org.apache.hadoop.yarn.api.records.ResourceRequest> amReqs) -
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, Set<String> applicationTags, List<org.apache.hadoop.yarn.api.records.ResourceRequest> amReqs, ApplicationPlacementContext placementContext, long startTime) -
RMAppImpl
public RMAppImpl(org.apache.hadoop.yarn.api.records.ApplicationId applicationId, RMContext rmContext, org.apache.hadoop.conf.Configuration config, String name, org.apache.hadoop.security.UserGroupInformation userUgi, String queue, org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext submissionContext, YarnScheduler scheduler, ApplicationMasterService masterService, long submitTime, String applicationType, Set<String> applicationTags, List<org.apache.hadoop.yarn.api.records.ResourceRequest> amReqs, ApplicationPlacementContext placementContext, long startTime)
-
-
Method Details
-
startTimelineCollector
public void startTimelineCollector()Starts the application level timeline collector for this app. This should be used only if the timeline service v.2 is enabled. -
stopTimelineCollector
public void stopTimelineCollector()Stops the application level timeline collector for this app. This should be used only if the timeline service v.2 is enabled. -
getApplicationId
public org.apache.hadoop.yarn.api.records.ApplicationId getApplicationId()Description copied from interface:RMAppThe application id for thisRMApp.- Specified by:
getApplicationIdin interfaceRMApp- Returns:
- the
ApplicationIdfor thisRMApp.
-
getApplicationSubmissionContext
public org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext getApplicationSubmissionContext()Description copied from interface:RMAppThe application submission context for thisRMApp- Specified by:
getApplicationSubmissionContextin interfaceRMApp- Returns:
- the
ApplicationSubmissionContextfor thisRMApp
-
getFinalApplicationStatus
public org.apache.hadoop.yarn.api.records.FinalApplicationStatus getFinalApplicationStatus()Description copied from interface:RMAppThe final finish state of the AM when unregistering as inFinishApplicationMasterRequest.setFinalApplicationStatus(FinalApplicationStatus).- Specified by:
getFinalApplicationStatusin interfaceRMApp- Returns:
- the final finish state of the AM as set in
FinishApplicationMasterRequest.setFinalApplicationStatus(FinalApplicationStatus).
-
getState
Description copied from interface:RMAppThe current state of theRMApp.- Specified by:
getStatein interfaceRMApp- Returns:
- the current state
RMAppStatefor this application.
-
getUser
Description copied from interface:RMAppThe user who submitted this application. -
getProgress
public float getProgress()Description copied from interface:RMAppProgress of application.- Specified by:
getProgressin interfaceRMApp- Returns:
- the progress of the
RMApp.
-
getRMAppAttempt
public RMAppAttempt getRMAppAttempt(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId) Description copied from interface:RMAppRMAppcan have multiple application attemptsRMAppAttempt. This method returns theRMAppAttemptcorresponding toApplicationAttemptId.- Specified by:
getRMAppAttemptin interfaceRMApp- Parameters:
appAttemptId- the application attempt id- Returns:
- the
RMAppAttemptcorresponding to theApplicationAttemptId.
-
getQueue
Description copied from interface:RMAppEach Application is submitted to a queue decided byApplicationSubmissionContext.setQueue(String). This method returns the queue to which an application was submitted. -
setQueue
Description copied from interface:RMAppReflects a change in the application's queue from the one specified in theApplicationSubmissionContext. -
getCollectorData
public org.apache.hadoop.yarn.server.api.records.AppCollectorData getCollectorData()Description copied from interface:RMAppThe timeline collector information for the application. It should be used only if the timeline service v.2 is enabled.- Specified by:
getCollectorDatain interfaceRMApp- Returns:
- the data for the application's collector, including collector address, RM ID, version and collector token. Return null if the timeline service v.2 is not enabled.
-
setCollectorData
public void setCollectorData(org.apache.hadoop.yarn.server.api.records.AppCollectorData incomingData) -
getCollectorInfo
public org.apache.hadoop.yarn.api.records.CollectorInfo getCollectorInfo()Description copied from interface:RMAppThe timeline collector information to be sent to AM. It should be used only if the timeline service v.2 is enabled.- Specified by:
getCollectorInfoin interfaceRMApp- Returns:
- collector info, including collector address and collector token. Return null if the timeline service v.2 is not enabled.
-
removeCollectorData
public void removeCollectorData() -
getName
Description copied from interface:RMAppThe name of the application as set inApplicationSubmissionContext.setApplicationName(String). -
getCurrentAppAttempt
Description copied from interface:RMAppRMAppcan have multiple application attemptsRMAppAttempt. This method returns the currentRMAppAttempt.- Specified by:
getCurrentAppAttemptin interfaceRMApp- Returns:
- the current
RMAppAttempt
-
getAppAttempts
Description copied from interface:RMAppRMAppcan have multiple application attemptsRMAppAttempt. This method returns the allRMAppAttempts for the RMApp.- Specified by:
getAppAttemptsin interfaceRMApp- Returns:
- all
RMAppAttempts for the RMApp.
-
pullRMNodeUpdates
Description copied from interface:RMAppTo receive the collection of allRMNodes whose updates have been received by the RMApp. Updates can be node becoming lost or becoming healthy etc. The method clears the information from theRMApp. So each call to this method gives the delta from the previous call.- Specified by:
pullRMNodeUpdatesin interfaceRMApp- Parameters:
upNodes- Map into which the updates are transferred, with each node updates as the key, and theNodeUpdateTypefor that update as the corresponding value.- Returns:
- the number of nodes added to the
Map
-
createAndGetApplicationReport
public org.apache.hadoop.yarn.api.records.ApplicationReport createAndGetApplicationReport(String clientUserName, boolean allowAccess) Description copied from interface:RMAppTo 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:- host - set to "N/A"
- RPC port - set to -1
- client token - set to "N/A"
- diagnostics - set to "N/A"
- tracking URL - set to "N/A"
- original tracking URL - set to "N/A"
- resource usage report - all values are -1
- Specified by:
createAndGetApplicationReportin interfaceRMApp- Parameters:
clientUserName- the user name of the client requesting the reportallowAccess- whether to allow full access to the report- Returns:
- the
ApplicationReportdetailing the status of the application.
-
getFinishTime
public long getFinishTime()Description copied from interface:RMAppThe finish time of theRMApp- Specified by:
getFinishTimein interfaceRMApp- Returns:
- the finish time of the application.,
-
getStartTime
public long getStartTime()Description copied from interface:RMAppthe start time of the application.- Specified by:
getStartTimein interfaceRMApp- Returns:
- the start time of the application.
-
getLaunchTime
public long getLaunchTime()Description copied from interface:RMAppThe launch time of the application. Since getStartTime() returns what is essentially submit time, this new field is to prevent potential backwards compatibility issues.- Specified by:
getLaunchTimein interfaceRMApp- Returns:
- the launch time of the application.
-
getSubmitTime
public long getSubmitTime()Description copied from interface:RMAppthe submit time of the application.- Specified by:
getSubmitTimein interfaceRMApp- Returns:
- the submit time of the application.
-
getTrackingUrl
Description copied from interface:RMAppThe tracking url for the application master.- Specified by:
getTrackingUrlin interfaceRMApp- Returns:
- the tracking url for the application master.
-
getOriginalTrackingUrl
Description copied from interface:RMAppThe original tracking url for the application master.- Specified by:
getOriginalTrackingUrlin interfaceRMApp- Returns:
- the original tracking url for the application master.
-
getDiagnostics
Description copied from interface:RMAppthe diagnostics information for the application master.- Specified by:
getDiagnosticsin interfaceRMApp- Returns:
- the diagnostics information for the application master.
-
getMaxAppAttempts
public int getMaxAppAttempts()Description copied from interface:RMAppThe number of max attempts of the application.- Specified by:
getMaxAppAttemptsin interfaceRMApp- Returns:
- the number of max attempts of the application.
-
handle
- Specified by:
handlein interfaceorg.apache.hadoop.yarn.event.EventHandler<RMAppEvent>
-
recover
- Specified by:
recoverin interfaceRecoverable
-
getNumFailedAppAttempts
public int getNumFailedAppAttempts() -
getApplicationType
Description copied from interface:RMAppReturns the application type- Specified by:
getApplicationTypein interfaceRMApp- Returns:
- the application type.
-
getApplicationTags
Description copied from interface:RMAppGet tags for the application- Specified by:
getApplicationTagsin interfaceRMApp- Returns:
- tags corresponding to the application
-
isAppFinalStateStored
public boolean isAppFinalStateStored()Description copied from interface:RMAppCheck whether this application's state has been saved to the state store.- Specified by:
isAppFinalStateStoredin interfaceRMApp- Returns:
- the flag indicating whether the applications's state is stored.
-
createApplicationState
public org.apache.hadoop.yarn.api.records.YarnApplicationState createApplicationState()Description copied from interface:RMAppCreate the external user-facing state of ApplicationMaster from the current state of theRMApp.- Specified by:
createApplicationStatein interfaceRMApp- Returns:
- the external user-facing state of ApplicationMaster.
-
isAppInFinalState
-
isAppInCompletedStates
public boolean isAppInCompletedStates()Description copied from interface:RMAppTo verify whether app has reached in its completing/completed states.- Specified by:
isAppInCompletedStatesin interfaceRMApp- Returns:
- True/False to confirm whether app is in final states
-
getApplicationPlacementContext
Description copied from interface:RMAppGet the application -> queue placement context- Specified by:
getApplicationPlacementContextin interfaceRMApp- Returns:
- ApplicationPlacementContext
-
getRecoveredFinalState
-
getRanNodes
Description copied from interface:RMAppNodes on which the containers for thisRMAppran.- Specified by:
getRanNodesin interfaceRMApp- Returns:
- the set of nodes that ran any containers from this
RMAppAdd more node on which containers for thisRMAppran
-
getRMAppMetrics
Description copied from interface:RMAppGet RMAppMetrics of theRMApp.- Specified by:
getRMAppMetricsin interfaceRMApp- Returns:
- metrics
-
setSystemClock
@Private @VisibleForTesting public void setSystemClock(org.apache.hadoop.yarn.util.Clock clock) -
getReservationId
public org.apache.hadoop.yarn.api.records.ReservationId getReservationId()- Specified by:
getReservationIdin interfaceRMApp
-
getAMResourceRequests
- Specified by:
getAMResourceRequestsin interfaceRMApp
-
getLogAggregationReportsForApp
public Map<org.apache.hadoop.yarn.api.records.NodeId,org.apache.hadoop.yarn.server.api.protocolrecords.LogAggregationReport> getLogAggregationReportsForApp()- Specified by:
getLogAggregationReportsForAppin interfaceRMApp
-
aggregateLogReport
public void aggregateLogReport(org.apache.hadoop.yarn.api.records.NodeId nodeId, org.apache.hadoop.yarn.server.api.protocolrecords.LogAggregationReport report) -
getLogAggregationFailureMessagesForNM
public String getLogAggregationFailureMessagesForNM(org.apache.hadoop.yarn.api.records.NodeId nodeId) -
getLogAggregationStatusForAppReport
public org.apache.hadoop.yarn.api.records.LogAggregationStatus getLogAggregationStatusForAppReport()- Specified by:
getLogAggregationStatusForAppReportin interfaceRMApp
-
getAppNodeLabelExpression
- Specified by:
getAppNodeLabelExpressionin interfaceRMApp
-
getAmNodeLabelExpression
Description copied from interface:RMAppReturn the node label expression of the AM container.- Specified by:
getAmNodeLabelExpressionin interfaceRMApp- Returns:
- the node label expression.
-
getCallerContext
public org.apache.hadoop.ipc.CallerContext getCallerContext()- Specified by:
getCallerContextin interfaceRMApp
-
getNextAttemptId
@Private @VisibleForTesting public int getNextAttemptId() -
getApplicationTimeouts
- Specified by:
getApplicationTimeoutsin interfaceRMApp
-
updateApplicationTimeout
-
getApplicationPriority
public org.apache.hadoop.yarn.api.records.Priority getApplicationPriority()Description copied from interface:RMAppGet priority of the application.- Specified by:
getApplicationPriorityin interfaceRMApp- Returns:
- priority
-
setApplicationPriority
public void setApplicationPriority(org.apache.hadoop.yarn.api.records.Priority applicationPriority) -
getApplicationSchedulingEnvs
Description copied from interface:RMAppGet the application scheduling environment variables.- Specified by:
getApplicationSchedulingEnvsin interfaceRMApp- Returns:
- Map of envs related to application scheduling preferences.
-
onInvalidStateTransition
catch the InvalidStateTransition.- Parameters:
state- RMAppState.rmAppEventType- RMAppEventType.
-
getRealUser
- Specified by:
getRealUserin interfaceRMApp
-