Repository: incubator-zeppelin Updated Branches: refs/heads/master 36b3b8d15 -> 486ed2375
[ZEPPELIN-923] Apply new mechanism to ShellInterpreter ### What is this PR for? This PR applies the new interpreter registration mechanism to Shell interpreter. ### What type of PR is it? Improvement ### Todos * [x] - Remove static property definition code lines in `shellInterpreter.java` and add `interpreter-setting.json` under the `shell/src/main/resources` ### What is the Jira issue? [ZEPPELIN-923](https://issues.apache.org/jira/browse/ZEPPELIN-923) ### How should this be tested? 1. apply patch 2. rm -r `interpreter/sh` and `conf/interpreter.json` 3. build source 4. bin/zeppelin-daemon.sh start 5. Run some shell command ### Screenshots (if appropriate) ### Questions: * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Author: AhyoungRyu <[email protected]> Closes #956 from AhyoungRyu/ZEPPELIN-923 and squashes the following commits: 3df8c7d [AhyoungRyu] ZEPPELIN-923: exclude interpreter-setting.json be3e22e [AhyoungRyu] ZEPPELIN-923: Change defaultValue 5000 -> 60000 b70d650 [AhyoungRyu] ZEPPELIN-923: Apply new interpreter mechanism to Shell interpreter Project: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/commit/486ed237 Tree: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/tree/486ed237 Diff: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/diff/486ed237 Branch: refs/heads/master Commit: 486ed2375ffc0d2986d43d54e62370e823d390d5 Parents: 36b3b8d Author: AhyoungRyu <[email protected]> Authored: Sat Jun 4 20:44:26 2016 -0700 Committer: Prabhjyot Singh <[email protected]> Committed: Tue Jun 7 10:46:25 2016 +0530 ---------------------------------------------------------------------- pom.xml | 1 + .../org/apache/zeppelin/shell/ShellInterpreter.java | 15 --------------- shell/src/main/resources/interpreter-setting.json | 15 +++++++++++++++ 3 files changed, 16 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/486ed237/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 8799ff6..970f6cb 100755 --- a/pom.xml +++ b/pom.xml @@ -475,6 +475,7 @@ <exclude>conf/zeppelin-env.sh</exclude> <exclude>spark-*-bin*/**</exclude> <exclude>.spark-dist/**</exclude> + <exclude>**/interpreter-setting.json</exclude> <!-- bundled from bootstrap --> <exclude>docs/assets/themes/zeppelin/bootstrap/**</exclude> http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/486ed237/shell/src/main/java/org/apache/zeppelin/shell/ShellInterpreter.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/zeppelin/shell/ShellInterpreter.java b/shell/src/main/java/org/apache/zeppelin/shell/ShellInterpreter.java index e3c4d0c..1331225 100644 --- a/shell/src/main/java/org/apache/zeppelin/shell/ShellInterpreter.java +++ b/shell/src/main/java/org/apache/zeppelin/shell/ShellInterpreter.java @@ -45,27 +45,12 @@ public class ShellInterpreter extends Interpreter { Logger logger = LoggerFactory.getLogger(ShellInterpreter.class); private static final String EXECUTOR_KEY = "executor"; public static final String SHELL_COMMAND_TIMEOUT = "shell.command.timeout.millisecs"; - public static final String DEFAULT_COMMAND_TIMEOUT = "600000"; int commandTimeOut; private static final boolean isWindows = System .getProperty("os.name") .startsWith("Windows"); final String shell = isWindows ? "cmd /c" : "bash -c"; - static { - Interpreter.register( - "sh", - "sh", - ShellInterpreter.class.getName(), - new InterpreterPropertyBuilder() - .add( - SHELL_COMMAND_TIMEOUT, - DEFAULT_COMMAND_TIMEOUT, - "Shell command time out in millisecs. Default = 600000") - .build() - ); - } - public ShellInterpreter(Properties property) { super(property); } http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/486ed237/shell/src/main/resources/interpreter-setting.json ---------------------------------------------------------------------- diff --git a/shell/src/main/resources/interpreter-setting.json b/shell/src/main/resources/interpreter-setting.json new file mode 100644 index 0000000..5e9a051 --- /dev/null +++ b/shell/src/main/resources/interpreter-setting.json @@ -0,0 +1,15 @@ +[ + { + "group": "sh", + "name": "sh", + "className": "org.apache.zeppelin.shell.ShellInterpreter", + "properties": { + "shell.command.timeout.millisecs": { + "envName": "SHELL_COMMAND_TIMEOUT", + "propertyName": "shell.command.timeout.millisecs", + "defaultValue": "60000", + "description": "Shell command time out in millisecs. Default = 60000" + } + } + } +] \ No newline at end of file
