Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create mobile job #121

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
add new jobs
mikev committed Jul 23, 2023
commit 9d6da05d86878715ca91c61e5271206caf465e58
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: iot-data-reward-totals-silver-query
namespace: spark
data:
query.sql: |
SELECT
date, sum(dc_transfer_amount_iot) AS data-iot-total
FROM TABLE_IOT_REWARDS
---
apiVersion: "sparkoperator.k8s.io/v1beta2"
kind: SparkApplication
metadata:
name: iot-data-reward-totals-silver
namespace: spark
spec:
type: Scala
mode: cluster
image: "public.ecr.aws/k0m1p4t7/spark:v3.4.0-aws"
imagePullPolicy: Always
mainClass: Main
mainApplicationFile: "s3a://foundation-data-lake-requester-pays/jars/spark-streaming-sql-assembly-1.0.jar"
sparkVersion: "3.4.0"
restartPolicy:
type: OnFailure
onFailureRetries: 3
onFailureRetryInterval: 10
onSubmissionFailureRetries: 3
onSubmissionFailureRetryInterval: 10
sparkConf:
spark.databricks.delta.autoCompact.enabled: "true"
hadoopConf:
fs.s3a.aws.credentials.provider: com.amazonaws.auth.WebIdentityTokenCredentialsProvider
volumes:
- name: "tmp"
hostPath:
path: "/tmp"
type: Directory
- name: config-vol
configMap:
name: iot-data-reward-totals-silver-query
items:
- key: query.sql
path: query.sql
driver:
serviceAccount: spark-data-lake-access
cores: 1
coreLimit: "1200m"
memory: "512m"
nodeSelector:
node.kubernetes.io/instance-type: m5.large
envVars:
TABLE_IOT_REWARDS: s3a://foundation-data-lake-requester-pays/silver/iot-reward-share
PARTITION_BY: "date"
CHECKPOINT: s3a://foundation-data-lake-requester-pays/checkpoints/iot-data-reward-totals
OUTPUT: s3a://foundation-data-lake-requester-pays/silver/iot-data-reward-totals
QUERY_PATH: /app/query.sql
labels:
version: 3.4.0
volumeMounts:
- name: "test-volume"
mountPath: "/tmp"
- name: config-vol
mountPath: /app
executor:
serviceAccount: spark-data-lake-access
cores: 1
coreLimit: "1200m"
instances: 3
memory: "10G"
tolerations: # Schedule executor pods on spot instance group
- key: dedicated
operator: Equal
value: spark
effect: NoSchedule
nodeSelector:
nodegroup-type: spot
labels:
version: 3.4.0
volumeMounts:
- name: "tmp"
mountPath: "/tmp"
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: iot-packet-counts-silver-query
namespace: spark
data:
query.sql: |
SELECT
date, count(payload_hash) AS count
FROM TABLE_IOT_PACKETS
---
apiVersion: "sparkoperator.k8s.io/v1beta2"
kind: SparkApplication
metadata:
name: iot-packet-counts-silver
namespace: spark
spec:
type: Scala
mode: cluster
image: "public.ecr.aws/k0m1p4t7/spark:v3.4.0-aws"
imagePullPolicy: Always
mainClass: Main
mainApplicationFile: "s3a://foundation-data-lake-requester-pays/jars/spark-streaming-sql-assembly-1.0.jar"
sparkVersion: "3.4.0"
restartPolicy:
type: OnFailure
onFailureRetries: 3
onFailureRetryInterval: 10
onSubmissionFailureRetries: 3
onSubmissionFailureRetryInterval: 10
sparkConf:
spark.databricks.delta.autoCompact.enabled: "true"
hadoopConf:
fs.s3a.aws.credentials.provider: com.amazonaws.auth.WebIdentityTokenCredentialsProvider
volumes:
- name: "tmp"
hostPath:
path: "/tmp"
type: Directory
- name: config-vol
configMap:
name: iot-packet-counts-silver-query
items:
- key: query.sql
path: query.sql
driver:
serviceAccount: spark-data-lake-access
cores: 1
coreLimit: "1200m"
memory: "512m"
nodeSelector:
node.kubernetes.io/instance-type: m5.large
envVars:
TABLE_IOT_PACKETS: s3a://foundation-data-lake-requester-pays/silver/iot-packets
PARTITION_BY: "date"
CHECKPOINT: s3a://foundation-data-lake-requester-pays/checkpoints/iot-packet-counts
OUTPUT: s3a://foundation-data-lake-requester-pays/silver/iot-packet-counts
QUERY_PATH: /app/query.sql
labels:
version: 3.4.0
volumeMounts:
- name: "test-volume"
mountPath: "/tmp"
- name: config-vol
mountPath: /app
executor:
serviceAccount: spark-data-lake-access
cores: 1
coreLimit: "1200m"
instances: 3
memory: "10G"
tolerations: # Schedule executor pods on spot instance group
- key: dedicated
operator: Equal
value: spark
effect: NoSchedule
nodeSelector:
nodegroup-type: spot
labels:
version: 3.4.0
volumeMounts:
- name: "tmp"
mountPath: "/tmp"
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: iot-payload-totals-silver-query
namespace: spark
data:
query.sql: |
SELECT
date, sum(payload_size) AS payload_total
FROM TABLE_IOT_PACKETS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested these? I don't think you can do an aggregate in spark streaming without a window

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not need to be an aggregate over a 24-hour period. The count(region) could be over whatever time period the job chooses. However the job windows do need to be non-overlapping. How can we guarantee non-overlapping windows?

---
apiVersion: "sparkoperator.k8s.io/v1beta2"
kind: SparkApplication
metadata:
name: iot-payload-totals-silver
namespace: spark
spec:
type: Scala
mode: cluster
image: "public.ecr.aws/k0m1p4t7/spark:v3.4.0-aws"
imagePullPolicy: Always
mainClass: Main
mainApplicationFile: "s3a://foundation-data-lake-requester-pays/jars/spark-streaming-sql-assembly-1.0.jar"
sparkVersion: "3.4.0"
restartPolicy:
type: OnFailure
onFailureRetries: 3
onFailureRetryInterval: 10
onSubmissionFailureRetries: 3
onSubmissionFailureRetryInterval: 10
sparkConf:
spark.databricks.delta.autoCompact.enabled: "true"
hadoopConf:
fs.s3a.aws.credentials.provider: com.amazonaws.auth.WebIdentityTokenCredentialsProvider
volumes:
- name: "tmp"
hostPath:
path: "/tmp"
type: Directory
- name: config-vol
configMap:
name: iot-payload-totals-silver-query
items:
- key: query.sql
path: query.sql
driver:
serviceAccount: spark-data-lake-access
cores: 1
coreLimit: "1200m"
memory: "512m"
nodeSelector:
node.kubernetes.io/instance-type: m5.large
envVars:
TABLE_IOT_PACKETS: s3a://foundation-data-lake-requester-pays/silver/iot-packets
PARTITION_BY: "date"
CHECKPOINT: s3a://foundation-data-lake-requester-pays/checkpoints/iot-payload-totals
OUTPUT: s3a://foundation-data-lake-requester-pays/silver/iot-payload-totals
QUERY_PATH: /app/query.sql
labels:
version: 3.4.0
volumeMounts:
- name: "test-volume"
mountPath: "/tmp"
- name: config-vol
mountPath: /app
executor:
serviceAccount: spark-data-lake-access
cores: 1
coreLimit: "1200m"
instances: 3
memory: "10G"
tolerations: # Schedule executor pods on spot instance group
- key: dedicated
operator: Equal
value: spark
effect: NoSchedule
nodeSelector:
nodegroup-type: spot
labels:
version: 3.4.0
volumeMounts:
- name: "tmp"
mountPath: "/tmp"