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 Classes
    Modifier and Type
    Class
    Description
    static interface 
     

    Nested classes/interfaces inherited from interface org.apache.hadoop.service.Service

    org.apache.hadoop.service.Service.STATE
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
    Time to wait between checks of the allocation file
    static final long
    Time 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.Logger
     
    static final long
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.hadoop.fs.Path
    getAllocationFile(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.
    void
    Updates the allocation list from the allocation config file.
    void
    serviceInit(org.apache.hadoop.conf.Configuration conf)
     
    void
     
    void
     
    void
     

    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • LOG

      public static final org.slf4j.Logger LOG
    • ALLOC_RELOAD_INTERVAL_MS

      public static final long ALLOC_RELOAD_INTERVAL_MS
      Time to wait between checks of the allocation file
      See Also:
    • ALLOC_RELOAD_WAIT_MS

      public static final long ALLOC_RELOAD_WAIT_MS
      Time 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

      public AllocationFileLoaderService(FairScheduler scheduler)
  • Method Details

    • serviceInit

      public void serviceInit(org.apache.hadoop.conf.Configuration conf) throws Exception
      Overrides:
      serviceInit in class org.apache.hadoop.service.AbstractService
      Throws:
      Exception
    • serviceStart

      public void serviceStart() throws Exception
      Overrides:
      serviceStart in class org.apache.hadoop.service.AbstractService
      Throws:
      Exception
    • serviceStop

      public void serviceStop() throws Exception
      Overrides:
      serviceStop in class org.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

      public void setReloadListener(AllocationFileLoaderService.Listener reloadListener)
    • reloadAllocations

      Updates 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

      protected List<org.apache.hadoop.yarn.security.Permission> 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