-
Notifications
You must be signed in to change notification settings - Fork 0
/
upload.sh
executable file
·50 lines (46 loc) · 1.17 KB
/
upload.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bash
# write test script
mkdir -p scripts/src
cat << EOF > scripts/src/threadsleep.py
import sys
from time import sleep
from pyspark.sql import SparkSession
spark = SparkSession.builder.appName("threadsleep").getOrCreate()
def sleep_for_x_seconds(x):sleep(x*20)
sc=spark.sparkContext
sc.parallelize(range(1,6), 5).foreach(sleep_for_x_seconds)
spark.stop()
EOF
# write pod templates
mkdir -p scripts/config
cat << EOF > scripts/config/driver-template.yaml
apiVersion: v1
kind: Pod
spec:
nodeSelector:
type: 'karpenter'
provisioner: 'spark-driver'
tolerations:
- key: 'spark-driver'
operator: 'Exists'
effect: 'NoSchedule'
containers:
- name: spark-kubernetes-driver
EOF
cat << EOF > scripts/config/executor-template.yaml
apiVersion: v1
kind: Pod
spec:
nodeSelector:
type: 'karpenter'
provisioner: 'spark-executor'
tolerations:
- key: 'spark-executor'
operator: 'Exists'
effect: 'NoSchedule'
containers:
- name: spark-kubernetes-executor
EOF
# sync to S3
DEFAULT_BUCKET_NAME=$(terraform -chdir=./infra output --raw default_bucket_name)
aws s3 sync . s3://$DEFAULT_BUCKET_NAME --exclude "*" --include "scripts/*"