Class AllocationFileLoaderService
java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.AllocationFileLoaderService
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hadoop.service.Service
@Public
@Unstable
public class AllocationFileLoaderService
extends org.apache.hadoop.service.AbstractService
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.apache.hadoop.service.Service
org.apache.hadoop.service.Service.STATE -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longTime to wait between checks of the allocation filestatic final longTime to wait after the allocation has been modified before reloading it (this is done to prevent loading a file that hasn't been fully written).static final org.slf4j.Loggerstatic final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.hadoop.fs.PathgetAllocationFile(org.apache.hadoop.conf.Configuration conf) Path to XML file containing allocations.protected List<org.apache.hadoop.yarn.security.Permission>Returns the list of default permissions.voidUpdates the allocation list from the allocation config file.voidserviceInit(org.apache.hadoop.conf.Configuration conf) voidvoidvoidsetReloadListener(AllocationFileLoaderService.Listener reloadListener) 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
-
LOG
public static final org.slf4j.Logger LOG -
ALLOC_RELOAD_INTERVAL_MS
public static final long ALLOC_RELOAD_INTERVAL_MSTime to wait between checks of the allocation file- See Also:
-
ALLOC_RELOAD_WAIT_MS
public static final long ALLOC_RELOAD_WAIT_MSTime to wait after the allocation has been modified before reloading it (this is done to prevent loading a file that hasn't been fully written).- See Also:
-
THREAD_JOIN_TIMEOUT_MS
public static final long THREAD_JOIN_TIMEOUT_MS- See Also:
-
-
Constructor Details
-
AllocationFileLoaderService
-
-
Method Details
-
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
-
getAllocationFile
@VisibleForTesting public org.apache.hadoop.fs.Path getAllocationFile(org.apache.hadoop.conf.Configuration conf) throws org.apache.hadoop.fs.UnsupportedFileSystemException Path to XML file containing allocations. If the path is relative, it is searched for in the classpath, but loaded like a regular File.- Parameters:
conf- configuration.- Returns:
- Allocation File Path.
- Throws:
org.apache.hadoop.fs.UnsupportedFileSystemException- File system for a given file system name/scheme is not supported.
-
setReloadListener
-
reloadAllocations
public void reloadAllocations() throws IOException, ParserConfigurationException, SAXException, AllocationConfigurationExceptionUpdates the allocation list from the allocation config file. This file is expected to be in the XML format specified in the design doc.- Throws:
IOException- if the config file cannot be read.AllocationConfigurationException- if allocations are invalid.ParserConfigurationException- if XML parser is misconfigured.SAXException- if config file is malformed.
-
getDefaultPermissions
Returns the list of default permissions. The default permission for the root queue is everybody ("*") and the default permission for all other queues is nobody (""). The default permission list would be loaded before the permissions from allocation file.- Returns:
- default permission list
-