Class AuxiliaryService
java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.yarn.server.api.AuxiliaryService
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hadoop.service.Service
@Public
@Evolving
public abstract class AuxiliaryService
extends org.apache.hadoop.service.AbstractService
A generic service that will be started by the NodeManager. This is a service
that administrators have to configure on each node by setting
YarnConfiguration.NM_AUX_SERVICES.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.hadoop.service.Service
org.apache.hadoop.service.Service.STATE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionMethod that gets the local dirs path handler for this Auxiliary Service.abstract ByteBufferRetrieve meta-data for thisAuxiliaryService.protected org.apache.hadoop.fs.PathGet the path specific to this auxiliary service to use for recovery.abstract voidinitializeApplication(ApplicationInitializationContext initAppContext) A new application is started on this NodeManager.voidinitializeContainer(ContainerInitializationContext initContainerContext) A new container is started on this NodeManager.voidsetAuxiliaryLocalPathHandler(AuxiliaryLocalPathHandler auxiliaryLocalPathHandler) Method that sets the local dirs path handler for this Auxiliary Service.voidsetRecoveryPath(org.apache.hadoop.fs.Path recoveryPath) Set the path for this auxiliary service to use for storing state that will be used during recovery.abstract voidstopApplication(ApplicationTerminationContext stopAppContext) An application is finishing on this NodeManager.voidstopContainer(ContainerTerminationContext stopContainerContext) A container is finishing on this NodeManager.Methods inherited from class org.apache.hadoop.service.AbstractService
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, serviceInit, serviceStart, serviceStop, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
-
Constructor Details
-
AuxiliaryService
-
-
Method Details
-
getRecoveryPath
protected org.apache.hadoop.fs.Path getRecoveryPath()Get the path specific to this auxiliary service to use for recovery.- Returns:
- state storage path or null if recovery is not enabled
-
initializeApplication
A new application is started on this NodeManager. This is a signal to thisAuxiliaryServiceabout the application initialization.- Parameters:
initAppContext- context for the application's initialization
-
stopApplication
An application is finishing on this NodeManager. This is a signal to thisAuxiliaryServiceabout the same.- Parameters:
stopAppContext- context for the application termination
-
getMetaData
Retrieve meta-data for thisAuxiliaryService. Applications using thisAuxiliaryServiceSHOULD know the format of the meta-data - ideally each service should provide a method to parse out the information to the applications. One example of meta-data is contact information so that applications can access the service remotely. This will only be called after the service'sAbstractService.start()method has finished. the result may be cached.The information is passed along to applications via
StartContainersResponse.getAllServicesMetaData()that is returned byContainerManagementProtocol.startContainers(StartContainersRequest)- Returns:
- meta-data for this service that should be made available to applications.
-
initializeContainer
A new container is started on this NodeManager. This is a signal to thisAuxiliaryServiceabout the container initialization. This method is called when the NodeManager receives the container launch command from the ApplicationMaster and before the container process is launched.- Parameters:
initContainerContext- context for the container's initialization
-
stopContainer
A container is finishing on this NodeManager. This is a signal to thisAuxiliaryServiceabout the same.- Parameters:
stopContainerContext- context for the container termination
-
setRecoveryPath
public void setRecoveryPath(org.apache.hadoop.fs.Path recoveryPath) Set the path for this auxiliary service to use for storing state that will be used during recovery.- Parameters:
recoveryPath- where recoverable state should be stored
-
getAuxiliaryLocalPathHandler
Method that gets the local dirs path handler for this Auxiliary Service.- Returns:
- auxiliaryPathHandler object that is used to read from and write to valid local Dirs.
-
setAuxiliaryLocalPathHandler
Method that sets the local dirs path handler for this Auxiliary Service.- Parameters:
auxiliaryLocalPathHandler- the pathHandler for this auxiliary service
-