Repository: zeppelin Updated Branches: refs/heads/master 7976f5b9e -> 6fd41fa3c
[ZEPPELIN-921] Apply new mechanism to KnitR and RRepl ### What is this PR for? Applies new registration mechanism for R interpreter ### What type of PR is it? [Refactoring] ### What is the Jira issue? https://issues.apache.org/jira/browse/ZEPPELIN-921 ### How should this be tested? Build zeppelin with R profile enabled and run several R snippets ### Questions: * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Author: Igor Drozdov <[email protected]> Closes #1946 from DrIgor/ZEPPELIN-921 and squashes the following commits: 9ad6f28 [Igor Drozdov] New registration mechanism for R interpreter Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/6fd41fa3 Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/6fd41fa3 Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/6fd41fa3 Branch: refs/heads/master Commit: 6fd41fa3c58d58558b94d55ec244a4e393df055a Parents: 7976f5b Author: Igor Drozdov <[email protected]> Authored: Wed Jan 25 11:36:53 2017 +0300 Committer: Jongyoul Lee <[email protected]> Committed: Wed Feb 22 15:41:26 2017 +0900 ---------------------------------------------------------------------- .../org/apache/zeppelin/rinterpreter/KnitR.java | 6 --- .../org/apache/zeppelin/rinterpreter/RRepl.java | 6 --- r/src/main/resources/interpreter-setting.json | 48 ++++++++++++++++++++ .../zeppelin/rinterpreter/RInterpreter.scala | 12 ----- 4 files changed, 48 insertions(+), 24 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zeppelin/blob/6fd41fa3/r/src/main/java/org/apache/zeppelin/rinterpreter/KnitR.java ---------------------------------------------------------------------- diff --git a/r/src/main/java/org/apache/zeppelin/rinterpreter/KnitR.java b/r/src/main/java/org/apache/zeppelin/rinterpreter/KnitR.java index e0af1d4..51a790c 100644 --- a/r/src/main/java/org/apache/zeppelin/rinterpreter/KnitR.java +++ b/r/src/main/java/org/apache/zeppelin/rinterpreter/KnitR.java @@ -34,12 +34,6 @@ import java.util.Properties; public class KnitR extends Interpreter implements WrappedInterpreter { KnitRInterpreter intp; - static { - Interpreter.register("knitr", "spark", KnitR.class.getName(), - RInterpreter.getProps() - ); - } - public KnitR(Properties property, Boolean startSpark) { super(property); intp = new KnitRInterpreter(property, startSpark); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/6fd41fa3/r/src/main/java/org/apache/zeppelin/rinterpreter/RRepl.java ---------------------------------------------------------------------- diff --git a/r/src/main/java/org/apache/zeppelin/rinterpreter/RRepl.java b/r/src/main/java/org/apache/zeppelin/rinterpreter/RRepl.java index 220b56e..0c46670 100644 --- a/r/src/main/java/org/apache/zeppelin/rinterpreter/RRepl.java +++ b/r/src/main/java/org/apache/zeppelin/rinterpreter/RRepl.java @@ -34,12 +34,6 @@ import java.util.Properties; public class RRepl extends Interpreter implements WrappedInterpreter { RReplInterpreter intp; - static { - Interpreter.register("r", "spark", RRepl.class.getName(), - RInterpreter.getProps() - ); - } - public RRepl(Properties property, Boolean startSpark) { super(property); intp = new RReplInterpreter(property, startSpark); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/6fd41fa3/r/src/main/resources/interpreter-setting.json ---------------------------------------------------------------------- diff --git a/r/src/main/resources/interpreter-setting.json b/r/src/main/resources/interpreter-setting.json new file mode 100644 index 0000000..3a751eb --- /dev/null +++ b/r/src/main/resources/interpreter-setting.json @@ -0,0 +1,48 @@ +[ + { + "group": "spark", + "name": "r", + "className": "org.apache.zeppelin.rinterpreter.RRepl", + "properties": { + "rhadoop.cmd": { + "envName": "HADOOP_CMD", + "defaultValue": "" + }, + "rhadooop.streamingjar": { + "envName": "HADOOP_STREAMING", + "defaultValue": "" + }, + "rscala.debug": { + "envName": "RSCALA_DEBUG", + "defaultValue": "false" + }, + "rscala.timeout": { + "envName": "RSCALA_TIMEOUT", + "defaultValue": "60" + } + } + }, + { + "group": "spark", + "name": "knitr", + "className": "org.apache.zeppelin.rinterpreter.RRepl", + "properties": { + "rhadoop.cmd": { + "envName": "HADOOP_CMD", + "defaultValue": "" + }, + "rhadooop.streamingjar": { + "envName": "HADOOP_STREAMING", + "defaultValue": "" + }, + "rscala.debug": { + "envName": "RSCALA_DEBUG", + "defaultValue": "false" + }, + "rscala.timeout": { + "envName": "RSCALA_TIMEOUT", + "defaultValue": "60" + } + } + } +] http://git-wip-us.apache.org/repos/asf/zeppelin/blob/6fd41fa3/r/src/main/scala/org/apache/zeppelin/rinterpreter/RInterpreter.scala ---------------------------------------------------------------------- diff --git a/r/src/main/scala/org/apache/zeppelin/rinterpreter/RInterpreter.scala b/r/src/main/scala/org/apache/zeppelin/rinterpreter/RInterpreter.scala index 9504573..6da923e 100644 --- a/r/src/main/scala/org/apache/zeppelin/rinterpreter/RInterpreter.scala +++ b/r/src/main/scala/org/apache/zeppelin/rinterpreter/RInterpreter.scala @@ -109,18 +109,6 @@ object RInterpreter { private val logger: Logger = LoggerFactory.getLogger(getClass) logger.trace("logging inside the RInterpreter singleton") - // These are the additional properties we need on top of the ones provided by the spark interpreters - lazy val props: Map[String, InterpreterProperty] = new InterpreterPropertyBuilder() - .add("rhadoop.cmd", "HADOOP_CMD", "rhadoop.cmd", "", "Usually /usr/bin/hadoop") - .add("rhadooop.streamingjar", "HADOOP_STREAMING", "rhadooop.streamingjar", "", "Usually /usr/lib/hadoop/contrib/streaming/hadoop-streaming-<version>.jar") - .add("rscala.debug", "RSCALA_DEBUG", "rscala.debug","false", "Whether to turn on rScala debugging") // TEST: Implemented but not tested - .add("rscala.timeout", "RSCALA_TIMEOUT", "rscala.timeout","60", "Timeout for rScala") // TEST: Implemented but not tested - .build - - def getProps() = { - props - } - // Some R interactive visualization packages insist on producing HTML that refers to javascript // or css by file path. These functions are intended to load those files and embed them into the // HTML as Base64 encoded DataURIs.
