Skip to content

Instantly share code, notes, and snippets.

@nickwallen
Last active June 30, 2018 09:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nickwallen/93f292379d77d201fe56f5d7daf0c7ec to your computer and use it in GitHub Desktop.
Save nickwallen/93f292379d77d201fe56f5d7daf0c7ec to your computer and use it in GitHub Desktop.

Stellar Interpreter for Apache Zeppelin

Apache Zeppelin is a web-based notebook that enables data-driven, interactive data analytics and collaborative documents with SQL, Scala and more. This project provides a means to run the Stellar REPL directly within a Zeppelin Notebook.

Installation

Currently, you need to manually install the Stellar Interpreter in Zeppelin. In the future this step could be automated by the Metron Mpack.

To install the Stellar Interpreter in your Apache Zeppelin installation, follow these instructions. This is paraphrased from the Zeppelin docs.

  1. Build and install Metron. Metron and its dependencies will be retrieved from your local Maven repository.

    cd $METRON_HOME
    mvn clean install -DskipTests
    
  2. If you do not already have Zeppelin installed, download and unpack Apache Zeppelin. The directory in which you unpack Zeppelin will be referred to as $ZEPPELIN_HOME.

  3. If Zeppelin was already installed, make sure that it is not running.

  4. Create a settings directory for the Stellar interpreter.

    mkdir $ZEPPELIN_HOME/interpreter/stellar
    cat <<EOF > $ZEPPELIN_HOME/interpreter/stellar/interpreter-setting.json
    [
      {
        "group": "Metron",
        "name": "Stellar",
        "className": "org.apache.metron.stellar.zeppelin.StellarInterpreter",
        "properties": {
        }
      }
    ]
    EOF
    
  5. Create a Zeppelin Site file.

    cp $ZEPPELIN_HOME/conf/zeppelin-site.xml.template $ZEPPELIN_HOME/conf/zeppelin-site.xml
    
  6. Add the following to the bottom of your Zeppelin Site file (yet still above the closing </configuration> tag) located at $ZEPPELIN_HOME/conf/zeppelin-site.xml.

    <property>
        <name>zeppelin.interpreters</name>
        <value>org.apache.metron.stellar.zeppelin.StellarInterpreter</value>
    </property>
    
  7. Start Zeppelin.

    $ZEPPELIN_HOME/bin/zeppelin-daemon.sh start
    
  8. Navigate to Zeppelin running at http://localhost:8080/.

  9. Register the Stellar interpreter in Zeppelin.

    1. Click on the top-right menu item labelled "Anonymous" then choose "Interpreter" in the drop-down that opens.
  10. Configure the Stellar interpreter.

    1. Click on '+ Create' near the top-right.

    2. Define the following values.

      • Interpreter Name = stellar
      • Interpreter Group = Metron
    3. Under Options, set the following values.

      • The interpreter will be instantiated Per Note in isolated process.
    4. Under Dependencies, define the following fields, then click the "+" icon.

      • Artifact = org.apache.metron:stellar-zeppelin:0.4.2
    5. Click "Save"

  11. Wait for the intrepreter to start.

    1. Near the title 'stellar', will be a status icon. This will indicate that it is downloading the dependencies.

    2. Once the icon is shown as green, the interpreter is ready to work.

  12. Create a new notebook.

    1. Click on "Notebook" > "Create new note". Set the default Interpreter to Stellar.
  13. Execute Stellar in your notebook.

    1. In the first block, add the following Stellar, then click Run.

      %stellar
      
      2 in [2,3,4]
      
    2. In the next block, check which functions are available to you.

      %stellar
      
      %functions
      
    3. Try out auto-completion. In another block, type 'TO_' then press CTRL+. which will trigger the auto-complete mechanism in Stellar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment