org.apache.hadoop.yarn.server.nodemanager
Class LocalDirsHandlerService

java.lang.Object
  extended by org.apache.hadoop.service.AbstractService
      extended by org.apache.hadoop.yarn.server.nodemanager.LocalDirsHandlerService
All Implemented Interfaces:
Closeable, org.apache.hadoop.service.Service

public class LocalDirsHandlerService
extends org.apache.hadoop.service.AbstractService

The class which provides functionality of checking the health of the local directories of a node. This specifically manages nodemanager-local-dirs and nodemanager-log-dirs by periodically checking their health.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.hadoop.service.Service
org.apache.hadoop.service.Service.STATE
 
Constructor Summary
LocalDirsHandlerService()
           
 
Method Summary
 boolean areDisksHealthy()
          The minimum fraction of number of disks needed to be healthy for a node to be considered healthy in terms of disks is configured using YarnConfiguration.NM_MIN_HEALTHY_DISKS_FRACTION, with a default value of YarnConfiguration.DEFAULT_NM_MIN_HEALTHY_DISKS_FRACTION.
 String getDisksHealthReport()
           
 long getLastDisksCheckTime()
           
 List<String> getLocalDirs()
           
 org.apache.hadoop.fs.Path getLocalPathForWrite(String pathStr)
           
 org.apache.hadoop.fs.Path getLocalPathForWrite(String pathStr, long size, boolean checkWrite)
           
 List<String> getLogDirs()
           
 org.apache.hadoop.fs.Path getLogPathForWrite(String pathStr, boolean checkWrite)
           
 org.apache.hadoop.fs.Path getLogPathToRead(String pathStr)
           
protected  void serviceInit(org.apache.hadoop.conf.Configuration config)
          Method which initializes the timertask and its interval time.
protected  void serviceStart()
          Method used to start the disk health monitoring, if enabled.
protected  void serviceStop()
          Method used to terminate the disk health monitoring service.
static String[] validatePaths(String[] paths)
           
 
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
 

Constructor Detail

LocalDirsHandlerService

public LocalDirsHandlerService()
Method Detail

serviceInit

protected void serviceInit(org.apache.hadoop.conf.Configuration config)
                    throws Exception
Method which initializes the timertask and its interval time.

Overrides:
serviceInit in class org.apache.hadoop.service.AbstractService
Throws:
Exception

serviceStart

protected void serviceStart()
                     throws Exception
Method used to start the disk health monitoring, if enabled.

Overrides:
serviceStart in class org.apache.hadoop.service.AbstractService
Throws:
Exception

serviceStop

protected void serviceStop()
                    throws Exception
Method used to terminate the disk health monitoring service.

Overrides:
serviceStop in class org.apache.hadoop.service.AbstractService
Throws:
Exception

getLocalDirs

public List<String> getLocalDirs()
Returns:
the good/valid local directories based on disks' health

getLogDirs

public List<String> getLogDirs()
Returns:
the good/valid log directories based on disks' health

getDisksHealthReport

public String getDisksHealthReport()
Returns:
the health report of nm-local-dirs and nm-log-dirs

areDisksHealthy

public boolean areDisksHealthy()
The minimum fraction of number of disks needed to be healthy for a node to be considered healthy in terms of disks is configured using YarnConfiguration.NM_MIN_HEALTHY_DISKS_FRACTION, with a default value of YarnConfiguration.DEFAULT_NM_MIN_HEALTHY_DISKS_FRACTION.

Returns:
false if either (a) more than the allowed percentage of nm-local-dirs failed or (b) more than the allowed percentage of nm-log-dirs failed.

getLastDisksCheckTime

public long getLastDisksCheckTime()

getLocalPathForWrite

public org.apache.hadoop.fs.Path getLocalPathForWrite(String pathStr)
                                               throws IOException
Throws:
IOException

getLocalPathForWrite

public org.apache.hadoop.fs.Path getLocalPathForWrite(String pathStr,
                                                      long size,
                                                      boolean checkWrite)
                                               throws IOException
Throws:
IOException

getLogPathForWrite

public org.apache.hadoop.fs.Path getLogPathForWrite(String pathStr,
                                                    boolean checkWrite)
                                             throws IOException
Throws:
IOException

getLogPathToRead

public org.apache.hadoop.fs.Path getLogPathToRead(String pathStr)
                                           throws IOException
Throws:
IOException

validatePaths

public static String[] validatePaths(String[] paths)


Copyright © 2014 Apache Software Foundation. All Rights Reserved.