Class AuxServices
java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.yarn.server.nodemanager.containermanager.AuxServices
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hadoop.service.Service,org.apache.hadoop.service.ServiceStateChangeListener,org.apache.hadoop.yarn.event.EventHandler<AuxServicesEvent>
public class AuxServices
extends org.apache.hadoop.service.AbstractService
implements org.apache.hadoop.service.ServiceStateChangeListener, org.apache.hadoop.yarn.event.EventHandler<AuxServicesEvent>
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.hadoop.service.Service
org.apache.hadoop.service.Service.STATE -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidaddService(String name, org.apache.hadoop.yarn.server.api.AuxiliaryService service, AuxServiceRecord serviceRecord) Adds a service to the service map.protected org.apache.hadoop.fs.FileSystemGets current aux service records.voidhandle(AuxServicesEvent event) booleanReturns whether aux services manifest / dynamic loading is enabled.protected voidloadManifest(org.apache.hadoop.conf.Configuration conf, boolean startServices) Updates current aux services based on changes found in the manifest.protected org.apache.hadoop.fs.PathmaybeDownloadJars(String sName, String className, String remoteFile, AuxServiceFile.TypeEnum type, org.apache.hadoop.conf.Configuration conf) Copies the specified remote file to local NM aux service directory.protected static AuxServiceRecordnewAuxService(String name, String className) voidreload(AuxServiceRecords services) Reloads auxiliary services.protected voidReloads auxiliary services manifest.voidserviceInit(org.apache.hadoop.conf.Configuration conf) voidvoidprotected static voidsetClasspath(AuxServiceRecord service, String classpath) protected static voidsetSystemClasses(AuxServiceRecord service, String systemClasses) voidstateChanged(org.apache.hadoop.service.Service service) 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, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
-
Field Details
-
NM_AUX_SERVICE_DIR
- See Also:
-
NM_AUX_SERVICE_DIR_PERM
public static final org.apache.hadoop.fs.permission.FsPermission NM_AUX_SERVICE_DIR_PERM -
CLASS_NAME
- See Also:
-
SYSTEM_CLASSES
- See Also:
-
-
Method Details
-
isManifestEnabled
public boolean isManifestEnabled()Returns whether aux services manifest / dynamic loading is enabled. -
addService
protected final void addService(String name, org.apache.hadoop.yarn.server.api.AuxiliaryService service, AuxServiceRecord serviceRecord) Adds a service to the service map.- Parameters:
name- aux service nameservice- aux serviceserviceRecord- aux service record
-
getServiceRecords
Gets current aux service records.- Returns:
- a collection of service records
-
getMetaData
- Returns:
- the meta data for all registered services, that have been started. If a service has not been started no metadata will be available. The key is the name of the service as defined in the configuration.
-
maybeDownloadJars
@VisibleForTesting protected org.apache.hadoop.fs.Path maybeDownloadJars(String sName, String className, String remoteFile, AuxServiceFile.TypeEnum type, org.apache.hadoop.conf.Configuration conf) throws IOException Copies the specified remote file to local NM aux service directory. If the same file already exists (as determined by modification time), the file will not be copied again.- Parameters:
sName- service nameclassName- service class nameremoteFile- location of the file to downloadtype- type of file (STATIC for a jar or ARCHIVE for a tarball)conf- configuration- Returns:
- path of the downloaded file
- Throws:
IOException
-
reloadManifest
Reloads auxiliary services manifest. Must be called after service init.- Throws:
IOException- if manifest can't be loaded
-
reload
Reloads auxiliary services. Must be called after service init.- Parameters:
services- a list of auxiliary services- Throws:
IOException- if aux services have not been started yet or dynamic reloading is not enabled
-
loadManifest
@VisibleForTesting protected void loadManifest(org.apache.hadoop.conf.Configuration conf, boolean startServices) throws IOException Updates current aux services based on changes found in the manifest.- Parameters:
conf- configurationstartServices- if true starts services, otherwise only inits services- Throws:
IOException
-
serviceInit
- Overrides:
serviceInitin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
serviceStart
- Overrides:
serviceStartin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
serviceStop
- Overrides:
serviceStopin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
stateChanged
public void stateChanged(org.apache.hadoop.service.Service service) - Specified by:
stateChangedin interfaceorg.apache.hadoop.service.ServiceStateChangeListener
-
handle
- Specified by:
handlein interfaceorg.apache.hadoop.yarn.event.EventHandler<AuxServicesEvent>
-
newAuxService
-
setClasspath
-
setSystemClasses
-
getManifestFS
protected org.apache.hadoop.fs.FileSystem getManifestFS()
-