YARN-894. NodeHealthScriptRunner timeout checking is inaccurate on Windows. Contributed by Chuan Liu.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1501016 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris Nauroth 2013-07-08 23:40:43 +00:00
parent 8fdd5083bf
commit 31fff48ec4
3 changed files with 13 additions and 2 deletions

View File

@ -727,6 +727,9 @@ Release 2.1.0-beta - 2013-07-02
YARN-852. TestAggregatedLogFormat.testContainerLogsFileAccess fails on
Windows. (Chuan Liu via cnauroth)
YARN-894. NodeHealthScriptRunner timeout checking is inaccurate on Windows.
(Chuan Liu via cnauroth)
YARN-795. Fair scheduler queue metrics should subtract allocated vCores from
available vCores. (ywskycn via tucu)

View File

@ -32,6 +32,7 @@
import org.apache.hadoop.service.AbstractService;
import org.apache.hadoop.util.Shell.ExitCodeException;
import org.apache.hadoop.util.Shell.ShellCommandExecutor;
import org.apache.hadoop.util.Shell;
import org.apache.hadoop.util.StringUtils;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
@ -110,6 +111,11 @@ public void run() {
} catch (ExitCodeException e) {
// ignore the exit code of the script
status = HealthCheckerExitStatus.FAILED_WITH_EXIT_CODE;
// On Windows, we will not hit the Stream closed IOException
// thrown by stdout buffered reader for timeout event.
if (Shell.WINDOWS && shexec.isTimedOut()) {
status = HealthCheckerExitStatus.TIMED_OUT;
}
} catch (Exception e) {
LOG.warn("Caught exception : " + e.getMessage());
if (!shexec.isTimedOut()) {

View File

@ -30,6 +30,7 @@
import org.apache.hadoop.fs.FileContext;
import org.apache.hadoop.fs.FileUtil;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.util.Shell;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.factories.RecordFactory;
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
@ -51,7 +52,7 @@ public class TestNodeHealthService {
"modified-mapred-site.xml");
private File nodeHealthscriptFile = new File(testRootDir,
"failingscript.sh");
Shell.appendScriptExtension("failingscript"));
@Before
public void setup() {
@ -123,7 +124,8 @@ public void testNodeHealthScript() throws Exception {
factory.newRecordInstance(NodeHealthStatus.class);
String errorScript = "echo ERROR\n echo \"Tracker not healthy\"";
String normalScript = "echo \"I am all fine\"";
String timeOutScript = "sleep 4\n echo\"I am fine\"";
String timeOutScript = Shell.WINDOWS ? "@echo off\nping -n 4 127.0.0.1 >nul\necho \"I am fine\""
: "sleep 4\necho \"I am fine\"";
Configuration conf = getConfForNodeHealthScript();
conf.writeXml(new FileOutputStream(nodeHealthConfigFile));
conf.addResource(nodeHealthConfigFile.getName());