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

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

public class LocalDirsHandlerService
extends org.apache.hadoop.yarn.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.yarn.service.Service
org.apache.hadoop.yarn.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)
           
 void init(org.apache.hadoop.conf.Configuration config)
          Method which initializes the timertask and its interval time.
 void start()
          Method used to start the disk health monitoring, if enabled.
 void stop()
          Method used to terminate the disk health monitoring service.
 
Methods inherited from class org.apache.hadoop.yarn.service.AbstractService
getConfig, getName, getServiceState, getStartTime, register, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalDirsHandlerService

public LocalDirsHandlerService()
Method Detail

init

public void init(org.apache.hadoop.conf.Configuration config)
Method which initializes the timertask and its interval time.

Specified by:
init in interface org.apache.hadoop.yarn.service.Service
Overrides:
init in class org.apache.hadoop.yarn.service.AbstractService

start

public void start()
Method used to start the disk health monitoring, if enabled.

Specified by:
start in interface org.apache.hadoop.yarn.service.Service
Overrides:
start in class org.apache.hadoop.yarn.service.AbstractService

stop

public void stop()
Method used to terminate the disk health monitoring service.

Specified by:
stop in interface org.apache.hadoop.yarn.service.Service
Overrides:
stop in class org.apache.hadoop.yarn.service.AbstractService

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


Copyright © 2012 Apache Software Foundation. All Rights Reserved.