HADOOP-13115. dynamic subcommand docs should talk about exit vs. continue program flow
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/06961860 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/06961860 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/06961860 Branch: refs/heads/HADOOP-12930 Commit: 069618603357e0d18a955cf19b09ebd5d70e0cce Parents: 9e59ee2 Author: Allen Wittenauer <[email protected]> Authored: Sat May 7 13:20:39 2016 -0700 Committer: Allen Wittenauer <[email protected]> Committed: Thu May 12 16:01:27 2016 -0700 ---------------------------------------------------------------------- .../hadoop-common/src/site/markdown/UnixShellGuide.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/06961860/hadoop-common-project/hadoop-common/src/site/markdown/UnixShellGuide.md ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/site/markdown/UnixShellGuide.md b/hadoop-common-project/hadoop-common/src/site/markdown/UnixShellGuide.md index 2c87480..4a28f6d 100644 --- a/hadoop-common-project/hadoop-common/src/site/markdown/UnixShellGuide.md +++ b/hadoop-common-project/hadoop-common/src/site/markdown/UnixShellGuide.md @@ -121,6 +121,7 @@ Prior to executing a subcommand, the primary scripts will check for the existanc function yarn_subcommand_hello { echo "$@" + exit $? } ``` @@ -159,7 +160,7 @@ Some key environment variables related to Dynamic Subcommands: * HADOOP\_CLASSNAME -This is the name of the Java class to execute. +This is the name of the Java class to use when program execution continues. * HADOOP\_SHELL\_EXECNAME @@ -187,4 +188,6 @@ If this command can be executed as a daemon, set this to true. * HADOOP\_USER\_PARAMS -This is the full content of the command line, prior to any parsing done. It will contain flags such as `--debug`. It MAY NOT be manipulated. \ No newline at end of file +This is the full content of the command line, prior to any parsing done. It will contain flags such as `--debug`. It MAY NOT be manipulated. + +The Apache Hadoop runtime facilities require functions exit if no further processing is required. For example, in the hello example above, Java and other facilities were not required so a simple `exit $?` was sufficient. However, if the function were to utilize `HADOOP\_CLASSNAME`, then program execution must continue so that Java with the Apache Hadoop-specific parameters will be launched against the given Java class. Another example would be in the case of an unrecoverable error. It is the function's responsbility to print an appropriate message (preferably using the hadoop_error API call) and exit appropriately. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
