Skip to content

Instantly share code, notes, and snippets.

@LeiG
Last active October 26, 2017 00:01
Show Gist options
  • Save LeiG/b260cd23bd8b31094c4a2cebb6562eef to your computer and use it in GitHub Desktop.
Save LeiG/b260cd23bd8b31094c4a2cebb6562eef to your computer and use it in GitHub Desktop.
#!/bin/zsh
# gcloud-init initializes a Google dataproc cluster
# arguments:
# $1 jar
# $2 env
function gcloud-init () {
gcloud dataproc clusters create dp-$USER-$1-test \
--image-version 1.1 \
--num-workers 20 \
--initialization-actions "gs://tt-dp-prod-resources/initialization-actions/setup-common-credentials.sh" \
--initialization-actions "gs://tt-dp-prod-resources/initialization-actions/setup-aws-user-$2-spark-$1.sh" \
--master-machine-type "n1-standard-8" \
--worker-machine-type "n1-standard-8" \
--worker-boot-disk-size 80GB
}
# gcloud-kill kills an existing Google dataproc cluster
# arguments:
# $1 jar
function gcloud-kill () {
gcloud dataproc clusters delete dp-$USER-$1-test
}
# gcloud-tunnel establishes a tunnel to the master node of a Google dataproc cluster
# arguments:
# $1 jar
function gcloud-tunnel () {
gcloud compute ssh --zone=us-west1-a --ssh-flag="-D 1080" --ssh-flag="-N" --ssh-flag="-n" dp-$USER-$1-test-m
}
# gcloud-ssh ssh into a Google dataproc cluster
# arguments:
# $1 jar
function gcloud-ssh () {
gcloud compute ssh dp-$USER-$1-test-m
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment