Repository: hadoop Updated Branches: refs/heads/HDFS-10467 0e4661f7f -> 01e6d57d1
YARN-6368. Decommissioning an NM results in a -1 exit code (miklos.szeg...@cloudera.com via rkanter) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/1f1f8c6a Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/1f1f8c6a Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/1f1f8c6a Branch: refs/heads/HDFS-10467 Commit: 1f1f8c6adb784078b263948c72b1afe2ce5e4e72 Parents: 7b09362 Author: Robert Kanter <rkan...@apache.org> Authored: Fri Apr 7 14:28:07 2017 -0700 Committer: Inigo <inigo...@apache.org> Committed: Mon Apr 17 11:16:58 2017 -0700 ---------------------------------------------------------------------- .../yarn/server/nodemanager/NodeManager.java | 26 +++++++++++++++++--- .../nodemanager/TestNodeManagerResync.java | 2 +- 2 files changed, 23 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/1f1f8c6a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java index 60bd00b..1cff53f 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java @@ -83,6 +83,24 @@ public class NodeManager extends CompositeService implements EventHandler<NodeManagerEvent> { /** + * Node manager return status codes. + */ + public enum NodeManagerStatus { + NO_ERROR(0), + EXCEPTION(1); + + private int exitCode; + + NodeManagerStatus(int exitCode) { + this.exitCode = exitCode; + } + + public int getExitCode() { + return exitCode; + } + } + + /** * Priority of the NodeManager shutdown hook. */ public static final int SHUTDOWN_HOOK_PRIORITY = 30; @@ -421,7 +439,7 @@ public class NodeManager extends CompositeService return "NodeManager"; } - protected void shutDown() { + protected void shutDown(final int exitCode) { new Thread() { @Override public void run() { @@ -432,7 +450,7 @@ public class NodeManager extends CompositeService } finally { if (shouldExitOnShutdownEvent && !ShutdownHookManager.get().isShutdownInProgress()) { - ExitUtil.terminate(-1); + ExitUtil.terminate(exitCode); } } } @@ -457,7 +475,7 @@ public class NodeManager extends CompositeService .rebootNodeStatusUpdaterAndRegisterWithRM(); } catch (YarnRuntimeException e) { LOG.fatal("Error while rebooting NodeStatusUpdater.", e); - shutDown(); + shutDown(NodeManagerStatus.EXCEPTION.getExitCode()); } } }.start(); @@ -744,7 +762,7 @@ public class NodeManager extends CompositeService public void handle(NodeManagerEvent event) { switch (event.getType()) { case SHUTDOWN: - shutDown(); + shutDown(NodeManagerStatus.NO_ERROR.getExitCode()); break; case RESYNC: resyncWithRM(); http://git-wip-us.apache.org/repos/asf/hadoop/blob/1f1f8c6a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java index 04cfae9..5ab5c37 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java @@ -638,7 +638,7 @@ public class TestNodeManagerResync { } @Override - protected void shutDown() { + protected void shutDown(int exitCode) { synchronized (isNMShutdownCalled) { isNMShutdownCalled.set(true); isNMShutdownCalled.notify(); --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org