YARN-3375. NodeHealthScriptRunner.shouldRun() check is performing 3 times for starting NodeHealthScriptRunner (Devaraj K via wangda)

This commit is contained in:
Wangda Tan 2015-05-04 15:49:19 -07:00
parent 0d6aa5d609
commit 71f4de220c
4 changed files with 7 additions and 12 deletions

View File

@ -214,11 +214,6 @@ protected void serviceInit(Configuration conf) throws Exception {
*/ */
@Override @Override
protected void serviceStart() throws Exception { protected void serviceStart() throws Exception {
// if health script path is not configured don't start the thread.
if (!shouldRun(nodeHealthScript)) {
LOG.info("Not starting node health monitor");
return;
}
nodeHealthScriptScheduler = new Timer("NodeHealthMonitor-Timer", true); nodeHealthScriptScheduler = new Timer("NodeHealthMonitor-Timer", true);
// Start the timer task immediately and // Start the timer task immediately and
// then periodically at interval time. // then periodically at interval time.
@ -232,9 +227,6 @@ protected void serviceStart() throws Exception {
*/ */
@Override @Override
protected void serviceStop() { protected void serviceStop() {
if (!shouldRun(nodeHealthScript)) {
return;
}
if (nodeHealthScriptScheduler != null) { if (nodeHealthScriptScheduler != null) {
nodeHealthScriptScheduler.cancel(); nodeHealthScriptScheduler.cancel();
} }

View File

@ -299,6 +299,9 @@ Release 2.8.0 - UNRELEASED
YARN-3097. Logging of resource recovery on NM restart has redundancies YARN-3097. Logging of resource recovery on NM restart has redundancies
(Eric Payne via jlowe) (Eric Payne via jlowe)
YARN-3375. NodeHealthScriptRunner.shouldRun() check is performing 3 times for
starting NodeHealthScriptRunner. (Devaraj K via wangda)
Release 2.7.1 - UNRELEASED Release 2.7.1 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -21,7 +21,6 @@
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.service.CompositeService; import org.apache.hadoop.service.CompositeService;
import org.apache.hadoop.util.NodeHealthScriptRunner; import org.apache.hadoop.util.NodeHealthScriptRunner;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
/** /**
* The class which provides functionality of checking the health of the node and * The class which provides functionality of checking the health of the node and
@ -44,8 +43,7 @@ public NodeHealthCheckerService(NodeHealthScriptRunner scriptRunner,
@Override @Override
protected void serviceInit(Configuration conf) throws Exception { protected void serviceInit(Configuration conf) throws Exception {
if (NodeHealthScriptRunner.shouldRun( if (nodeHealthScriptRunner != null) {
conf.get(YarnConfiguration.NM_HEALTH_CHECK_SCRIPT_PATH))) {
addService(nodeHealthScriptRunner); addService(nodeHealthScriptRunner);
} }
addService(dirsHandler); addService(dirsHandler);

View File

@ -210,7 +210,9 @@ public static NodeHealthScriptRunner getNodeHealthScriptRunner(Configuration con
String nodeHealthScript = String nodeHealthScript =
conf.get(YarnConfiguration.NM_HEALTH_CHECK_SCRIPT_PATH); conf.get(YarnConfiguration.NM_HEALTH_CHECK_SCRIPT_PATH);
if(!NodeHealthScriptRunner.shouldRun(nodeHealthScript)) { if(!NodeHealthScriptRunner.shouldRun(nodeHealthScript)) {
LOG.info("Abey khali"); LOG.info("Node Manager health check script is not available "
+ "or doesn't have execute permission, so not "
+ "starting the node health script runner.");
return null; return null;
} }
long nmCheckintervalTime = conf.getLong( long nmCheckintervalTime = conf.getLong(