Skip to main content
# zdairi
zdairi is zeppelin CLI tool which wrapper zeppelin REST API for control notebook and interpreter.

Zeppelin REST API. see https://zeppelin.apache.org/docs/0.7.0/rest-api/rest-notebook.html

## Support version

* Zeppelin 0.6
* Zeppelin 0.7

## Prerequisites

* Python 2.7

# Install
python setup.py install
or
pip install zdairi

# Configuration

Using zdari with yaml format config.
```bash
$ zdairi COMMAND #Using default path '~/.zdari.yml'
$ zdairi -f /tmp/zdari.yml COMMAND #Using specified path
```

Config example:
```
zeppelin_url: http://your_zeppelin_url # Required
# Options
zeppelin_auth: true #Default is false
zeppelin_user: user_name
zeppelin_password: user_password

```
We support specified user to login zeppelin.

# Usage

Support commands:

* Notebook
* list
* run
* print
* create
* delete
* save

* Interpreter
* list
* restart


## Notebook commands


### LIST command

List notebooks id and name

```
$ zdairi notebook list [--notebook ${notebook_id|notebook_name}]
```

Output example

```
$ zdairi notebook list

id:[2C3XP3FS1], name:[my notebook1]
id:[2C9327A66], name:[my notebook2]
id:[2CFGUBJX2], name:[my notebook3]

```
```
$ zdairi notebook list --notebook "my notebook3"
id:[20170410-113013_1011211975], status:[FINISHED]
id:[20170410-113020_981608729], status:[FINISHED]
```


### RUN command

Run zeppelin notebook/paragraph by id of name
```
$ zdari notebook run --notebook ${notebook_id|$notebook_name} [--paragraph ${paragraph_id|$paragraph_name}] [--parameters ${json}]
```
Example
```
$ zdairi notebook run --notebook mynotebook --paragraph myparagraph --parameters '{ "params":{"forecastDate":"yoo"}}'
```

### PRINT command

Print zeppelin notebook as JSON
```
$ zdari notebook print --notebook ${notebook_id|$notebook_name}
```

### CREATE command

Create zeppelin notebook by .json/.nb
```
$ zdari notebook create --filepath ${filepath}
```

We support create notebook by zeppelin json format or our DSL format.

The format as below:

```
# ${notebook name}

############################################################ ${paragraph title} ############################################################
${paragraph context}

############################################################ ${paragraph title} ############################################################
${paragraph context}

```

```
# Test Notebook

############################################################ test_1 ############################################################
%spark
import org.apache.commons.io.IOUtils
import java.net.URL
import java.nio.charset.Charset
// load bank data
val bankText = sc.parallelize(
IOUtils.toString(
new URL("https://s3.amazonaws.com/apache-zeppelin/tutorial/bank/bank.csv"),
Charset.forName("utf8")).split("\n"))
case class Bank(age: Integer, job: String, marital: String, education: String, balance: Integer)

val bank = bankText.map(s => s.split(";")).filter(s => s(0) != "\"age\"").map(
s => Bank(s(0).toInt,
s(1).replaceAll("\"", ""),
s(2).replaceAll("\"", ""),
s(3).replaceAll("\"", ""),
s(5).replaceAll("\"", "").toInt
)
).toDF()
bank.registerTempTable("bank2")

############################################################ test_2 ############################################################
%pyspark
import os
print(os.environ['PYTHONPATH'])
count = sc.parallelize(range(1, 10000 + 1)).reduce(lambda x,y: x+y)
print("Pi is roughly %f" % (4.0 * count / 12))
accum = sc.accumulator(0)
sc.parallelize([1, 2, 3, 4]).foreach(lambda x: accum.add(x))
print(accum.value)

```

### DELETE command

Delete zeppelin notebook by notebook_id or notebook_name
```
$ zdari notebook delete --notebook ${notebook_id|$notebook_name}
```

### SAVE command
Save zeppelin notebook as xxx.np
```
$ zdari notebook save --notebook ${notebook_id|$notebook_name} --filepath $filepath
```


## Interpreter commands

### LIST command
List interpreters id and name

```
$ zdairi interpreter list
```

Output example
```
id:[2CBC3HCAX], name:[spark]
id:[2C9CZRM8P], name:[md]
id:[2CBBH2DVN], name:[angular]

```

Restart zeppelin interpreter
```
$ zdari interpreter restart --interpreter ${interpreter_id|$interpreter_name}
```

Metadata

Release files for zdairi 0.7.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zdairi 0.7.3
File Size Uploaded Provenance Actions
zdairi-0.7.3.tar.gz 9.3 kB Without provenance Details for zdairi-0.7.3.tar.gz

Release files / zdairi-0.7.3.tar.gz

Download URL zdairi-0.7.3.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
986ce4de5ad198c70f94356ef211b7be3d593d87ea15e13d4d0051da6bc62145
BLAKE2b-256 checksum
How to use checksums
c92f2655f578167449e5321fa0cf8f0b51a9628e127db78144ddce3ccaa90fa9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for zdairi 0.7.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page