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

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

public class NodeHealthScriptRunner
extends org.apache.hadoop.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.service.Service
org.apache.hadoop.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.
 boolean isHealthy()
          Gets the if the node is healthy or not
protected  void serviceInit(org.apache.hadoop.conf.Configuration conf)
           
protected  void serviceStart()
          Method used to start the Node health monitoring.
protected  void serviceStop()
          Method used to terminate the node health monitoring service.
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.
 
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

NodeHealthScriptRunner

public NodeHealthScriptRunner()
Method Detail

serviceInit

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

serviceStart

protected void serviceStart()
                     throws Exception
Method used to start the Node health monitoring.

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

serviceStop

protected void serviceStop()
Method used to terminate the node health monitoring service.

Overrides:
serviceStop in class org.apache.hadoop.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 © 2013 Apache Software Foundation. All Rights Reserved.