A Clojure library for managing Zeppelin notebooks using the Zeppelin Notebook REST API.
[clj-zeppelin "0.1.0-SNAPSHOT"]
The operations defined in this library are as follows :
This POST method creates a new note and returns the id of the newly created note.
(create-note! notebook-server-url payload)
notebook-server-url - Zeppelin server url
payload - The payload is a map with (compulsory) key :name (which is the name of the notebook), and optional key :paragraphs, which is a list of paragraphs. Each paragraph is a map with keys :title and :text.
(create-note! "http://[zeppelin-server]:[zeppelin-port]" {:name "Ocean Notebook"})
2DTW93XQ9 is the id of the created note.
This GET method returns a JSON array containing the name and id of all the available notes in the zeppelin server.
(list-notes notebook-server-url)
Input fields :
notebook-server-url - Zeppelin server url
Example :
(list-notes "http://[zeppelin-server]:[zeppelin-port]")
{:status "OK", :message "", :body [{:name "Zeppelin Tutorial/Basic Features (Spark)", :id "2A94M5J1Z"}]}
This DELETE method deletes a note on the zeppelin server by the given note id and returns a JSON array containing status.
(delete-note! notebook-server-url note-id)
notebook-server-url - Zeppelin server url
note-id - id of the notebook to be deleted
(delete-note! "http://[zeppelin-server]:[zeppelin-port]" "2DTW93XQ9")
{:status "OK", :message ""}
This POST method adds a new paragraph to an existing note and returns id of the newly created paragraph.
(create-paragraph! notebook-server-url note-id paragraph_data)
notebook-server-url - Zeppelin server url
note-id - id of existing notebook in zeppelin
paragraph_data - content to be added to the paragraph
(create-paragraph! "http://[zeppelin-server]:[zeppelin-port]" "2DTW93XQ9" (-> {:title "intro" :text (10 + 10)}))
20181029-070332_2137251371 is the id of the created paragraph.
This POST method runs the paragraph asynchronously by given note and paragraph id and returns an OK message.
(run-paragraph-async notebook-server-url note-id paragraph-id)
notebook-server-url - Zeppelin server url
note-id - id of the existing notebook in zeppelin
paragraph-id - id of the paragraph in the notebook
(run-paragraph-async "http://[zeppelin-server]:[zeppelin-port]" "2DTW93XQ9" "20181029-070332_2137251371")
OK
This POST method runs the paragraph synchronously by given note and paragraph id and returns a JSON array containing SUCCESS or ERROR status, depending on the outcome of paragraph execution.
(run-paragraph-sync notebook-server-url note-id paragraph-id)
notebook-server-url - Zeppelin server url
note-id - id of the existing notebook in zeppelin
paragraph-id - id of the paragraph in the notebook
(run-paragraph-sync "http://[zeppelin-server]:[zeppelin-port]" "2DTW93XQ9" "20181029-070332_2137251371")
{:code "SUCCESS", :msg [{:type "TEXT", :data "\nres1: Int = 20\n"}]}
This GET method gets the status of a single paragraph by the given note and paragraph id. The returned JSON array contains the paragraph id, paragraph status, paragraph finish date, paragraph start date.
(get-paragraph-status notebook-server-url note-id paragraph-id)
notebook-server-url - Zeppelin server url
note-id - id of the existing notebook in zeppelin
paragraph-id - id of the paragraph in the notebook
(get-paragraph-status "http://[zeppelin-server]:[zeppelin-port]" "2DTW93XQ9" "20181029-070332_2137251371")
{:progress "100", :started "Mon Oct 29 07:20:06 UTC 2018", :finished "Mon Oct 29 07:20:07 UTC 2018", :id "20181029-070332_2137251371", :status "FINISHED"}
This GET method retrieves an existing paragraph's information using the given id. The returned JSON array contains information about the paragraph.
(get-paragraph-info notebook-server-url note-id paragraph-id)
notebook-server-url - Zeppelin server url
note-id - id of the existing notebook in zeppelin
paragraph-id - id of the paragraph in the notebook
(get-paragraph-info "http://[zeppelin-server]:[zeppelin-port]" "2DTW93XQ9" "20181029-070332_2137251371")
{:apps [], :dateFinished "Oct 29, 2018 7:20:07 AM", :jobName "paragraph_1540796612560_-766558253", :config {}, :dateUpdated "Oct 29, 2018 7:03:32 AM", :settings {:params {}, :forms {}}, :title "intro", :status "FINISHED", :id "20181029-070332_2137251371", :progressUpdateIntervalMs 500, :dateCreated "Oct 29, 2018 7:03:32 AM", :dateStarted "Oct 29, 2018 7:20:06 AM", :user "anonymous", :text "20", :results {:code "SUCCESS", :msg [{:type "TEXT", :data "\nres1: Int = 20\n"}]}}
This POST method runs all paragraphs in the specified note and returns a status message.
(run-all-paragraphs notebook-server-url note-id)
notebook-server-url - Zeppelin server url
note-id - id of the existing notebook in zeppelin
(run-all-paragraphs "http://[zeppelin-server]:[zeppelin-port]" "2DTW93XQ9")
{:status "OK"}
docker run -p 8080:8080 apache/zeppelin:0.8.0
lein test
should create the Zeppelin docker container and run the testsCopyright © 2018 Dex
Distributed under the Apache 2.0 License
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close