summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2025-01-26 15:08:12 +0100
committerSanto Cariotti <santo@dcariotti.me>2025-01-26 15:08:12 +0100
commitf1d310658f8f8d7b1c1c7cf802cb98a451a61ed1 (patch)
tree953780c981faa1608ed735e203bd55a5db56c407
parente7bbd6ea60fc40e8d9a31ece57b1fcc7c170f0da (diff)
Add debug env on scripts
-rwxr-xr-xscripts/00-create-service-account.sh4
-rwxr-xr-xscripts/01-create-bucket.sh4
-rwxr-xr-xscripts/02-dataproc-copy-jar.sh4
-rwxr-xr-xscripts/03-update-network-for-dataproc.sh4
-rwxr-xr-xscripts/04-dataproc-create-cluster.sh8
-rwxr-xr-xscripts/05-dataproc-submit.sh6
-rwxr-xr-xscripts/06-dataproc-update-cluster.sh4
-rwxr-xr-xscripts/07-cleanup.sh4
8 files changed, 35 insertions, 3 deletions
diff --git a/scripts/00-create-service-account.sh b/scripts/00-create-service-account.sh
index 984e55b..5048df8 100755
--- a/scripts/00-create-service-account.sh
+++ b/scripts/00-create-service-account.sh
@@ -1,5 +1,9 @@
#!/bin/sh
+if [ -z $DEBUG ]; then
+ set -euxo pipefail
+fi
+
gcloud iam service-accounts create ${SERVICE_ACCOUNT} \
--description="Spark access account to Google Cloud Buckets" \
--display-name="Spark to Bucket"
diff --git a/scripts/01-create-bucket.sh b/scripts/01-create-bucket.sh
index 30bedc0..c7251ba 100755
--- a/scripts/01-create-bucket.sh
+++ b/scripts/01-create-bucket.sh
@@ -1,5 +1,9 @@
#!/bin/sh
+if [ ${DEBUG:+1} ]; then
+ set -exo pipefail
+fi
+
path="$1"
if [ -z "$path" ] || [ ! -e "$path" ]; then
diff --git a/scripts/02-dataproc-copy-jar.sh b/scripts/02-dataproc-copy-jar.sh
index de8795f..8fc3750 100755
--- a/scripts/02-dataproc-copy-jar.sh
+++ b/scripts/02-dataproc-copy-jar.sh
@@ -1,5 +1,9 @@
#!/bin/sh
+if [ ${DEBUG:+1} ]; then
+ set -euxo pipefail
+fi
+
cd ./co-purchase-analysis
SCALA_VERSION=2.12.10 sbt clean package
cd -
diff --git a/scripts/03-update-network-for-dataproc.sh b/scripts/03-update-network-for-dataproc.sh
index c091f22..47f78d6 100755
--- a/scripts/03-update-network-for-dataproc.sh
+++ b/scripts/03-update-network-for-dataproc.sh
@@ -1,5 +1,9 @@
#!/bin/sh
+if [ ${DEBUG:+1} ]; then
+ set -euxo pipefail
+fi
+
gcloud compute networks subnets update default \
--region=${REGION} \
--enable-private-ip-google-access
diff --git a/scripts/04-dataproc-create-cluster.sh b/scripts/04-dataproc-create-cluster.sh
index 8bdeccb..785949e 100755
--- a/scripts/04-dataproc-create-cluster.sh
+++ b/scripts/04-dataproc-create-cluster.sh
@@ -2,6 +2,10 @@
set -eu
+if [ ${DEBUG:+1} ]; then
+ set -xo pipefail
+fi
+
if [ "$#" -ne 3 ]; then
echo "Usage: 'sh ${PWD}/$0 <num-workers> <master-machine> <worker-machine>'"
exit 1
@@ -31,8 +35,8 @@ COMMON_PARAMS="\
--project=${PROJECT} \
--region=${REGION} \
--service-account=${SERVICE_ACCOUNT}@${PROJECT}.iam.gserviceaccount.com \
- --master-boot-disk-size=240 \
- --worker-boot-disk-size=240 \
+ --master-boot-disk-size=400 \
+ --worker-boot-disk-size=400 \
--worker-machine-type=${WORKER_MACHINE} \
--master-machine-type=${MASTER_MACHINE}"
diff --git a/scripts/05-dataproc-submit.sh b/scripts/05-dataproc-submit.sh
index b2c9e42..5b2153e 100755
--- a/scripts/05-dataproc-submit.sh
+++ b/scripts/05-dataproc-submit.sh
@@ -1,6 +1,10 @@
#!/bin/sh
-set -e
+set -eu
+
+if [ ${DEBUG:+1} ]; then
+ set -xo pipefail
+fi
if [ "$#" -ne 1 ]; then
echo "Usage: 'sh ${PWD}/$0 <num-partitions>'"
diff --git a/scripts/06-dataproc-update-cluster.sh b/scripts/06-dataproc-update-cluster.sh
index 8714e7d..dcf92e2 100755
--- a/scripts/06-dataproc-update-cluster.sh
+++ b/scripts/06-dataproc-update-cluster.sh
@@ -2,6 +2,10 @@
set -eu
+if [ ${DEBUG:+1} ]; then
+ set -xo pipefail
+fi
+
if [ "$#" -ne 3 ]; then
echo "Usage: 'sh ${PWD}/$0 <num-workers> <master-machine> <worker-machine>'"
exit 1
diff --git a/scripts/07-cleanup.sh b/scripts/07-cleanup.sh
index 98751b6..f51363b 100755
--- a/scripts/07-cleanup.sh
+++ b/scripts/07-cleanup.sh
@@ -1,5 +1,9 @@
#!/bin/sh
+if [ ${DEBUG:+1} ]; then
+ set -euxo pipefail
+fi
+
gcloud storage rm -r gs://
gcloud dataproc clusters delete ${CLUSTER} --region=${REGION}
gcloud iam service-accounts delete ${SERVICE_ACCOUNT}@${PROJECT}.iam.gserviceaccount.com