-
Notifications
You must be signed in to change notification settings - Fork 54
/
partitionsync_cronjob.yaml
40 lines (39 loc) · 1.13 KB
/
partitionsync_cronjob.yaml
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
---
kind: ConfigMap
apiVersion: v1
metadata:
name: presto-sync-scripts
data:
presto-sync.sh: |
set -e
TABLES=$(/opt/presto-cli --server presto:8080 --catalog hive --schema default --execute "SHOW TABLES;" | grep table | sed s/\"//g)
for i in $TABLES; do
echo $i
/opt/presto-cli --server presto:8080 --catalog hive --execute "CALL system.sync_partition_metadata(schema_name=>'default', table_name=>'$i', mode=>'FULL');"
done
echo "Done"
---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: cron-presto-sync
spec:
schedule: "0 12 * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: presto-timed-worker
image: joshuarobinson/presto-cli
command: ["sh", "-c", "--"]
args: ["bash /opt/presto-sync.sh"]
volumeMounts:
- name: presto-scripts-vol
mountPath: /opt/presto-sync.sh
subPath: presto-sync.sh
volumes:
- name: presto-scripts-vol
configMap:
name: presto-sync-scripts
restartPolicy: OnFailure