You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zeppelin.apache.org by Yunjian <zz...@gmail.com> on 2016/06/27 05:40:02 UTC

Write My Own Zeppelin Interpreter

Hi all,

Recently I am trying to write my own interpreter for scala, using
Zeppelin-0.6.0-snapshot built from source code.

I followed the instructions in
https://zeppelin.apache.org/docs/0.6.0-SNAPSHOT/development/writingzeppelininterpreter.html,
but I failed to make my interpreter work. So then I tried to write a much
simpler interpreter (doing nothing but print messages only in each
overriding methods) and I still failed to make the interpreter work. I got
confused and didn't know* if I missed some important steps :( . *Any help
will be appreciated.

Here are the steps how I wrote my interpreter:

1. Write a java file named SimpleInterpreter.java, design a class named
SimpleInterpreter and the class extends Interpreter provided by Zeppelin.
Then I implement the constructor and 8 methods: open(), close(),
interpreter(), cancel(), getProgress(), getFormType(), getScheduler(),
completion().

2. Compile the project using sbt. I think it's OK to compile the code using
sbt instead of mvn. The important thing is to get the jar anyway. Here the
SimpleInterpreter doesn't have other dependencies except Zeppelin
Interpreter.

3. Make a directory named simple in [Zeppelin-Home]/interpreter/, copy the
jar generated by sbt to the new directory. The jar contains
SimpleInterpreter.class only. And no other jars need to be copied.

4. Create a new file named interpreter-setting.json in the new directory
and write three key-value pairs:
    "group": "org",
    "name": "simple",
    "className": "simple.SimpleInterpreter"
(Here I have a question that why "org" instead of "simple" is shown in the
option box of "Interpreter group" when I create my interpreter in web UI.)

5. add "simple.SimpleInterpreter" in the value of "zeppelin.interpreters"
in zeppelin-site.xml under [Zeppelin-Home]/conf.

I attach related files mentioned above in this email.

But then after I restart the zeppelin daemon and try to run any scripts
using my interpreter, I get no results except a small Error. And if I look
into the log file, I get the some exceptions and it seems failed to find my
interpreter. Details can be seen in the attachments.

Sorry to make a long email. And hope anyone could offer me some help.

Bests,
ZHAO Yunjian

Research Assistant, The Chinese University of Hong Kong
ᐧ

Re: Write My Own Zeppelin Interpreter

Posted by Jongyoul Lee <jo...@gmail.com>.
Hello,

It looks like a bug which occurs without any property in a
interpreter-setting.json.

Could you please add properties section?

[
  {
    "group": "org",
    "name": "simple",
    "className": "simple.SimpleInterpreter", properties: {}}
]

If it works, please tell me. I'll make a PR for this bug.

Hope this help,
JL

On Monday, 27 June 2016, Yunjian <zz...@gmail.com> wrote:

> Hi all,
>
> Recently I am trying to write my own interpreter for scala, using
> Zeppelin-0.6.0-snapshot built from source code.
>
> I followed the instructions in
> https://zeppelin.apache.org/docs/0.6.0-SNAPSHOT/development/writingzeppelininterpreter.html,
> but I failed to make my interpreter work. So then I tried to write a much
> simpler interpreter (doing nothing but print messages only in each
> overriding methods) and I still failed to make the interpreter work. I got
> confused and didn't know* if I missed some important steps :( . *Any help
> will be appreciated.
>
> Here are the steps how I wrote my interpreter:
>
> 1. Write a java file named SimpleInterpreter.java, design a class named
> SimpleInterpreter and the class extends Interpreter provided by Zeppelin.
> Then I implement the constructor and 8 methods: open(), close(),
> interpreter(), cancel(), getProgress(), getFormType(), getScheduler(),
> completion().
>
> 2. Compile the project using sbt. I think it's OK to compile the code
> using sbt instead of mvn. The important thing is to get the jar anyway.
> Here the SimpleInterpreter doesn't have other dependencies except Zeppelin
> Interpreter.
>
> 3. Make a directory named simple in [Zeppelin-Home]/interpreter/, copy the
> jar generated by sbt to the new directory. The jar contains
> SimpleInterpreter.class only. And no other jars need to be copied.
>
> 4. Create a new file named interpreter-setting.json in the new directory
> and write three key-value pairs:
>     "group": "org",
>     "name": "simple",
>     "className": "simple.SimpleInterpreter"
> (Here I have a question that why "org" instead of "simple" is shown in the
> option box of "Interpreter group" when I create my interpreter in web UI.)
>
> 5. add "simple.SimpleInterpreter" in the value of "zeppelin.interpreters"
> in zeppelin-site.xml under [Zeppelin-Home]/conf.
>
> I attach related files mentioned above in this email.
>
> But then after I restart the zeppelin daemon and try to run any scripts
> using my interpreter, I get no results except a small Error. And if I look
> into the log file, I get the some exceptions and it seems failed to find my
> interpreter. Details can be seen in the attachments.
>
> Sorry to make a long email. And hope anyone could offer me some help.
>
> Bests,
> ZHAO Yunjian
>
> Research Assistant, The Chinese University of Hong Kong
> ᐧ
>


-- 
이종열, Jongyoul Lee, 李宗烈
http://madeng.net