Revert "YARN-5567. Fix script exit code checking in NodeHealthScriptRunner#reportHealthStatus. (Yufei Gu via rchiang)"
This reverts commit 05ede00386
.
This commit is contained in:
parent
401db4fc65
commit
cae331186d
|
@ -106,7 +106,6 @@ public class NodeHealthScriptRunner extends AbstractService {
|
||||||
shexec.execute();
|
shexec.execute();
|
||||||
} catch (ExitCodeException e) {
|
} catch (ExitCodeException e) {
|
||||||
// ignore the exit code of the script
|
// ignore the exit code of the script
|
||||||
exceptionStackTrace = StringUtils.stringifyException(e);
|
|
||||||
status = HealthCheckerExitStatus.FAILED_WITH_EXIT_CODE;
|
status = HealthCheckerExitStatus.FAILED_WITH_EXIT_CODE;
|
||||||
// On Windows, we will not hit the Stream closed IOException
|
// On Windows, we will not hit the Stream closed IOException
|
||||||
// thrown by stdout buffered reader for timeout event.
|
// thrown by stdout buffered reader for timeout event.
|
||||||
|
@ -163,7 +162,7 @@ public class NodeHealthScriptRunner extends AbstractService {
|
||||||
setHealthStatus(false, exceptionStackTrace);
|
setHealthStatus(false, exceptionStackTrace);
|
||||||
break;
|
break;
|
||||||
case FAILED_WITH_EXIT_CODE:
|
case FAILED_WITH_EXIT_CODE:
|
||||||
setHealthStatus(false, exceptionStackTrace);
|
setHealthStatus(true, "", now);
|
||||||
break;
|
break;
|
||||||
case FAILED:
|
case FAILED:
|
||||||
setHealthStatus(false, shexec.getOutput());
|
setHealthStatus(false, shexec.getOutput());
|
||||||
|
|
|
@ -91,7 +91,6 @@ public class TestNodeHealthScriptRunner {
|
||||||
public void testNodeHealthScript() throws Exception {
|
public void testNodeHealthScript() throws Exception {
|
||||||
String errorScript = "echo ERROR\n echo \"Tracker not healthy\"";
|
String errorScript = "echo ERROR\n echo \"Tracker not healthy\"";
|
||||||
String normalScript = "echo \"I am all fine\"";
|
String normalScript = "echo \"I am all fine\"";
|
||||||
String failWithExitCodeScript = "echo \"Not healthy\"; exit -1";
|
|
||||||
String timeOutScript =
|
String timeOutScript =
|
||||||
Shell.WINDOWS ? "@echo off\nping -n 4 127.0.0.1 >nul\necho \"I am fine\""
|
Shell.WINDOWS ? "@echo off\nping -n 4 127.0.0.1 >nul\necho \"I am fine\""
|
||||||
: "sleep 4\necho \"I am fine\"";
|
: "sleep 4\necho \"I am fine\"";
|
||||||
|
@ -125,12 +124,6 @@ public class TestNodeHealthScriptRunner {
|
||||||
nodeHealthScriptRunner.isHealthy());
|
nodeHealthScriptRunner.isHealthy());
|
||||||
Assert.assertEquals("", nodeHealthScriptRunner.getHealthReport());
|
Assert.assertEquals("", nodeHealthScriptRunner.getHealthReport());
|
||||||
|
|
||||||
// Script which fails with exit code.
|
|
||||||
writeNodeHealthScriptFile(failWithExitCodeScript, true);
|
|
||||||
timerTask.run();
|
|
||||||
Assert.assertFalse("Node health status reported healthy",
|
|
||||||
nodeHealthScriptRunner.isHealthy());
|
|
||||||
|
|
||||||
// Timeout script.
|
// Timeout script.
|
||||||
writeNodeHealthScriptFile(timeOutScript, true);
|
writeNodeHealthScriptFile(timeOutScript, true);
|
||||||
timerTask.run();
|
timerTask.run();
|
||||||
|
|
Loading…
Reference in New Issue