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

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

public class NodeHealthScriptRunner
extends org.apache.hadoop.yarn.service.AbstractService

The class which provides functionality of checking the health of the node using the configured node health script and reporting back to the service for which the health checker has been asked to report.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.hadoop.yarn.service.Service
org.apache.hadoop.yarn.service.Service.STATE
 
Constructor Summary
NodeHealthScriptRunner()
           
 
Method Summary
 String getHealthReport()
          Returns output from health script.
 long getLastReportedTime()
          Returns time stamp when node health script was last run.
 void init(org.apache.hadoop.conf.Configuration conf)
           
 boolean isHealthy()
          Gets the if the node is healthy or not
static boolean shouldRun(org.apache.hadoop.conf.Configuration conf)
          Method used to determine if or not node health monitoring service should be started or not.
 void start()
          Method used to start the Node health monitoring.
 void stop()
          Method used to terminate the node 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

NodeHealthScriptRunner

public NodeHealthScriptRunner()
Method Detail

init

public void init(org.apache.hadoop.conf.Configuration conf)
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 Node health monitoring.

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 node health monitoring service.

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

isHealthy

public boolean isHealthy()
Gets the if the node is healthy or not

Returns:
true if node is healthy

getHealthReport

public String getHealthReport()
Returns output from health script. if node is healthy then an empty string is returned.

Returns:
output from health script

getLastReportedTime

public long getLastReportedTime()
Returns time stamp when node health script was last run.

Returns:
timestamp when node health script was last run

shouldRun

public static boolean shouldRun(org.apache.hadoop.conf.Configuration conf)
Method used to determine if or not node health monitoring service should be started or not. Returns true if following conditions are met:
  1. Path to Node health check script is not empty
  2. Node health check script file exists

Parameters:
conf -
Returns:
true if node health monitoring service can be started.


Copyright © 2012 Apache Software Foundation. All Rights Reserved.