2017-06-16 08:46:01 +03:00
# Distributed Tools for Data Engineering (DTDE)
A suite of distributed tools to help engineers scale their work into Azure.
# Spark on DTDE
2017-04-13 04:47:44 +03:00
2017-04-21 02:54:36 +03:00
## Setup
1. Clone the repo
2. Use pip to install required packages:
```
pip3 install -r requirements.txt
2017-04-13 04:47:44 +03:00
```
2017-04-21 02:54:36 +03:00
3. Use setuptools:
2017-04-13 04:47:44 +03:00
```
2017-04-21 02:54:36 +03:00
python3 setup.py install
```
2017-05-12 23:25:47 +03:00
4. Rename 'configuration.cfg.template' to 'configuration.cfg' and fill in the fields for your Batch account and Storage account. These fields can be found in the Azure portal.
To complete this step, you will need an Azure account that has a Batch account and Storage account:
2017-04-21 02:54:36 +03:00
- To create an Azure account: https://azure.microsoft.com/free/
- To create a Batch account: https://docs.microsoft.com/en-us/azure/batch/batch-account-create-portal
- To create a Storage account: https://docs.microsoft.com/en-us/azure/storage/storage-create-storage-account
## Getting Started
2017-05-12 23:25:47 +03:00
The entire experience of this package is centered around a few commands in the bin folder.
2017-04-21 02:54:36 +03:00
2017-06-20 08:03:11 +03:00
### Create and setup your cluster
2017-04-21 02:54:36 +03:00
First, create your cluster:
```
./bin/spark-cluster-create \
2017-06-16 08:46:01 +03:00
--id < my-cluster-id > \
--size < number of nodes > \
--vm-size < vm-size > \
2017-06-20 08:03:11 +03:00
--custom-script < path to custom bash script to run on each node > (optional) \
2017-04-21 02:54:36 +03:00
--wait/--no-wait (optional)
```
2017-06-20 08:03:11 +03:00
You can also create your cluster with [low-priority ](https://docs.microsoft.com/en-us/azure/batch/batch-low-pri-vms ) VMs at an 80% discount by using ** --size-low-pri** instead of ** --size**:
```
./bin/spark-cluster-create \
--id < my-cluster-id > \
--size-low-pri < number of low-pri nodes >
--vm-size < vm-size >
```
2017-04-21 02:54:36 +03:00
When your cluster is ready, create a user for your cluster:
```
./bin/spark-cluster-create-user \
2017-06-16 08:46:01 +03:00
---id < my-cluster-id > \
2017-04-21 02:54:36 +03:00
--username < username > \
--password < password >
```
2017-06-20 08:03:11 +03:00
### Submit a Spark job
2017-04-21 02:54:36 +03:00
Now you can submit jobs to run against the cluster:
```
2017-06-16 08:46:01 +03:00
./bin/spark-submit \
--id < my-cluster-id > \
--name < my-job-name > \
[list of options] \
--application < path-to-spark-job >
2017-04-21 02:54:36 +03:00
```
2017-06-20 08:03:11 +03:00
### Interact with your Spark cluster
2017-06-16 08:46:01 +03:00
To view the spark UI, open up an ssh tunnel with the "masterui" option and a local port to map to:
2017-04-21 02:54:36 +03:00
```
./bin/spark-cluster-ssh \
2017-06-16 08:46:01 +03:00
--id < my-cluster-id > \
--masterui < local-port >
2017-04-21 02:54:36 +03:00
```
Optionally, you can also open up a jupyter notebook with the "jupyter" option to work in:
```
./bin/spark-cluster-ssh \
2017-06-16 08:46:01 +03:00
--id < my-cluster-id > \
2017-04-21 02:54:36 +03:00
--jupyter < local-port >
```
2017-06-20 08:03:11 +03:00
### Manage your Spark cluster
2017-04-21 02:54:36 +03:00
You can also see your clusters from the CLI:
```
./bin/spark-cluster-list
```
2017-06-16 08:46:01 +03:00
And get the state of any specified cluster:
```
2017-06-20 08:03:11 +03:00
./bin/spark-cluster-get --id < my-cluster-id >
2017-06-16 08:46:01 +03:00
```
Finally, you can delete any specified cluster:
2017-04-21 02:54:36 +03:00
```
2017-06-20 08:03:11 +03:00
./bin/spark-cluster-delete --id < my-cluster-id >
2017-04-21 02:54:36 +03:00
```