Skip to content

Commit

Permalink
[ZEPPELIN-921] Apply new mechanism to KnitR and RRepl
Browse files Browse the repository at this point in the history
### 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 <igor_drozdov@epam.com>

Closes #1946 from DrIgor/ZEPPELIN-921 and squashes the following commits:

9ad6f28 [Igor Drozdov] New registration mechanism for R interpreter
  • Loading branch information
DrIgor authored and jongyoul committed Feb 22, 2017
1 parent 7976f5b commit 6fd41fa
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 24 deletions.
6 changes: 0 additions & 6 deletions r/src/main/java/org/apache/zeppelin/rinterpreter/KnitR.java
Expand Up @@ -34,12 +34,6 @@
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);
Expand Down
6 changes: 0 additions & 6 deletions r/src/main/java/org/apache/zeppelin/rinterpreter/RRepl.java
Expand Up @@ -34,12 +34,6 @@
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);
Expand Down
48 changes: 48 additions & 0 deletions 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"
}
}
}
]
Expand Up @@ -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.
Expand Down

0 comments on commit 6fd41fa

Please sign in to comment.