From a1218571c2e32812055a8f0d0cb0e7d8a944f7e7 Mon Sep 17 00:00:00 2001 From: cto Date: Mon, 13 Jul 2015 15:38:26 +0300 Subject: [PATCH 1/3] updates to make your own interpreter --- .../development/writingzeppelininterpreter.md | 38 ++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/docs/development/writingzeppelininterpreter.md b/docs/development/writingzeppelininterpreter.md index 4e185ee7db2..29d05ff2613 100644 --- a/docs/development/writingzeppelininterpreter.md +++ b/docs/development/writingzeppelininterpreter.md @@ -14,7 +14,7 @@ Interpreters in the same InterpreterGroup can reference each other. For example, -Interpreter can be launched either using separate classloader or separate JVM process. Sometimes separate classloader causes problem especially when your interpreter uses reflections or trying to grab standard out/err. In this case, separate JVM process is the option you can select. (by checking 'fork' in Interpreter menu, which is default value) When Interpreter is running in separate JVM process, it's communicating with Zeppelin via thrift. +Interpreter can be launched either using separate JVM process or separate classloader. The default is using separate JVM process (by checking 'fork' in Interpreter menu). When Interpreter is running in separate JVM process, it's communicating with Zeppelin via thrift. The other option is to use separate classloader, note that sometime separate classloader can causes problem especially when your interpreter uses reflections or trying to grab standard out/err. ### Make your own Interpreter @@ -22,6 +22,16 @@ Creating a new interpreter is quite simple. Just extend [org.apache.zeppelin.int You can include org.apache.zeppelin:zeppelin-interpreter:[VERSION] artifact in your build system. +Your interpreter name is derived from the static register method + +``` +static { + Interpreter.register("MyInterpreterName", MyClassName.class.getName()); + } +``` + +This name will appear later in the interpreter name option box during the interpreter configuration process. + ### Install your interpreter binary Once you have build your interpreter, you can place your interpreter under directory with all the dependencies. @@ -32,17 +42,27 @@ Once you have build your interpreter, you can place your interpreter under direc ### Configure your interpreter -You can configure zeppelin.interpreters property in conf/zeppelin-site.xml -Property value is comma separated [INTERPRETER_CLASS_NAME] +To configure your interpreter you need to follow these steps: -for example, +1. create conf/zeppelin-site.xml by copying conf/zeppelin-site.xml.template to conf/zeppelin-site.xml -``` +2. Add your interpreter class name to the zeppelin.interpreters property in conf/zeppelin-site.xml + + Property value is comma separated [INTERPRETER_CLASS_NAME] +for example, + + ``` zeppelin.interpreters org.apache.zeppelin.spark.SparkInterpreter,org.apache.zeppelin.spark.PySparkInterpreter,org.apache.zeppelin.spark.SparkSqlInterpreter,org.apache.zeppelin.spark.DepInterpreter,org.apache.zeppelin.markdown.Markdown,org.apache.zeppelin.shell.ShellInterpreter,org.apache.zeppelin.hive.HiveInterpreter,com.me.MyNewInterpreter ``` +3. start zeppelin by running ```./bin/zeppelin-deamon start``` + +4. in the interpreter page, click the +Create button and configure your interpreter properties. +Now you are done and ready to use your interpreter. + +Note that the interpreters shipped with zeppelin have a slightly different configuration process as they are registered by default without the use of the zeppelin-site.xml. ### Use your interpreter @@ -61,11 +81,11 @@ println(a)
#### 0.6.0 and later -Inside of a noteobok, %[INTERPRETER\_GROUP].[INTERPRETER\_NAME] directive will call your interpreter. +Inside of a notebook, %[INTERPRETER\_GROUP].[INTERPRETER\_NAME] directive will call your interpreter. Note that the first interpreter configuration in zeppelin.interpreters will be the default one. You can omit either [INTERPRETER\_GROUP] or [INTERPRETER\_NAME]. Omit [INTERPRETER\_NAME] selects first available interpreter in the [INTERPRETER\_GROUP]. -Omit '[INTERPRETER\_GROUP]' will selects [INTERPRETER\_NAME] from defualt interpreter group. +Omit '[INTERPRETER\_GROUP]' will selects [INTERPRETER\_NAME] from default interpreter group. For example, if you have two interpreter myintp1 and myintp2 in group mygrp, @@ -86,7 +106,7 @@ and you can call myintp2 like codes for myintp2 ``` -If you ommit your interpreter name, it'll selects first available interpreter in the group (myintp1) +If you omit your interpreter name, it'll selects first available interpreter in the group (myintp1) ``` %mygrp @@ -95,7 +115,7 @@ codes for myintp1 ``` -You can only ommit your interpreter group when your interpreter group is selected as a default group. +You can only omit your interpreter group when your interpreter group is selected as a default group. ``` %myintp2 From 5614606c72fd041f4329d5ce005f5dc2bfa3b914 Mon Sep 17 00:00:00 2001 From: cto Date: Tue, 14 Jul 2015 08:55:45 +0300 Subject: [PATCH 2/3] change wording about default configuration for zeppelin interpreters --- docs/development/writingzeppelininterpreter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/development/writingzeppelininterpreter.md b/docs/development/writingzeppelininterpreter.md index 29d05ff2613..cb073ae0d27 100644 --- a/docs/development/writingzeppelininterpreter.md +++ b/docs/development/writingzeppelininterpreter.md @@ -62,7 +62,7 @@ for example, 4. in the interpreter page, click the +Create button and configure your interpreter properties. Now you are done and ready to use your interpreter. -Note that the interpreters shipped with zeppelin have a slightly different configuration process as they are registered by default without the use of the zeppelin-site.xml. +Note that the interpreters shipped with zeppelin have a [default configuration](https://github.com/apache/incubator-zeppelin/blob/master/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java#L397) which is used when there is no zeppelin-site.xml. ### Use your interpreter From 43383105127e21a62cbac48f34bc3d2ac4e19095 Mon Sep 17 00:00:00 2001 From: cto Date: Thu, 16 Jul 2015 10:25:16 +0300 Subject: [PATCH 3/3] update wording about separete jvm process and add note about name of the interpreter --- docs/development/writingzeppelininterpreter.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/development/writingzeppelininterpreter.md b/docs/development/writingzeppelininterpreter.md index cb073ae0d27..95ca5ab5cd8 100644 --- a/docs/development/writingzeppelininterpreter.md +++ b/docs/development/writingzeppelininterpreter.md @@ -14,7 +14,7 @@ Interpreters in the same InterpreterGroup can reference each other. For example, -Interpreter can be launched either using separate JVM process or separate classloader. The default is using separate JVM process (by checking 'fork' in Interpreter menu). When Interpreter is running in separate JVM process, it's communicating with Zeppelin via thrift. The other option is to use separate classloader, note that sometime separate classloader can causes problem especially when your interpreter uses reflections or trying to grab standard out/err. +All Interpreters in the same interpreter group are launched in a single, separate JVM process. The Interpreter communicates with Zeppelin engine via thrift. ### Make your own Interpreter @@ -30,8 +30,14 @@ static { } ``` -This name will appear later in the interpreter name option box during the interpreter configuration process. +The name will appear later in the interpreter name option box during the interpreter configuration process. +The name of the interpreter is what you later write to identify a paragraph which should be interpreted using this interpreter. + +``` +%MyInterpreterName +some interpreter spesific code... +``` ### Install your interpreter binary Once you have build your interpreter, you can place your interpreter under directory with all the dependencies.