rtdmp.sh 1.48 KB
Newer Older
wang-jinfeng committed
1 2 3 4 5 6
#!/bin/bash

source ../dmp_env.sh

today=${ScheduleTime}

7
date_time=$(date +"%Y%m%d%H" -d "-1 hour $today")
wang-jinfeng committed
8 9 10 11 12

date_path=$(date +%Y/%m/%d/%H -d "-1 hour $today")

INPUT="s3://mob-emr-test/dataplatform/rtdmp_pre/${date_path}"

13 14
old_date_time=$(date +"%Y%m%d%H" -d "-2 hour $today")

WangJinfeng committed
15
old_date_path=$(date +%Y/%m/%d/%H -d "-2 hour $today")
WangJinfeng committed
16 17 18

OLD_MERGE_INPUT="s3://mob-emr-test/dataplatform/DataWareHouse/data/dwh/audience_merge/${old_date_path}"

WangJinfeng committed
19
check_await ${OLD_MERGE_INPUT}/_SUCCESS
WangJinfeng committed
20

WangJinfeng committed
21 22
sleep 120

WangJinfeng committed
23
OUTPUT="s3://mob-emr-test/dataplatform/DataWareHouse/data/dwh/audience_merge/${date_path}"
wang-jinfeng committed
24 25 26

spark-submit --class mobvista.dmp.datasource.rtdmp.RTDmpMain \
  --name "RTDmpMain.${date_time}" \
WangJinfeng committed
27 28
  --conf spark.sql.shuffle.partitions=2000 \
  --conf spark.default.parallelism=2000 \
wang-jinfeng committed
29 30 31
  --conf spark.kryoserializer.buffer.max=512m \
  --conf spark.kryoserializer.buffer=64m \
  --master yarn --deploy-mode cluster \
WangJinfeng committed
32
  --executor-memory 8g --driver-memory 6g --executor-cores 4 --num-executors 100 \
wang-jinfeng committed
33
  .././DMP.jar \
WangJinfeng committed
34
  -datetime ${date_time} -old_datetime ${old_date_time} -input ${INPUT} -output ${OUTPUT} -coalesce 400
wang-jinfeng committed
35 36

if [[ $? -ne 0 ]]; then
wang-jinfeng committed
37 38
  exit 255
fi
WangJinfeng committed
39

40
mount_partition "audience_merge" "dt='${date_time}'" "$OUTPUT"
WangJinfeng committed
41 42 43 44 45 46 47 48

expire_time=$(date +"%Y%m%d%H" -d "-24 hour $today")

expire_date_path=$(date +%Y/%m/%d/%H -d "-24 hour $today")

EXPIRE_OUTPUT_PATH="s3://mob-emr-test/dataplatform/DataWareHouse/data/dwh/audience_merge/${expire_date_path}"

unmount_partition "audience_merge" "dt='${expire_time}'" "${EXPIRE_OUTPUT_PATH}"