#!/bin/bash

source ../dmp_env.sh

today=${ScheduleTime}

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

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

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

OUTPUT="s3://mob-emr-test/dataplatform/rtdmp_deal/${date_path}/0"

spark-submit --class mobvista.dmp.datasource.rtdmp.RTDmpMainDeal \
    --name "RTDmpMainDeal.${date_time}" \
    --conf spark.sql.shuffle.partitions=10000 \
    --conf spark.default.parallelism=500 \
    --conf spark.kryoserializer.buffer.max=256m \
    --conf spark.speculation=true \
    --conf spark.speculation.quantile=0.9 \
    --conf spark.speculation.multiplier=1.3 \
    --conf spark.executor.extraJavaOptions="-XX:+UseG1GC" \
    --master yarn --deploy-mode cluster --executor-memory 4g --driver-memory 4g  --executor-cores 4 --num-executors 50 \
    ../${JAR} -time "${date_time}" -data_utime "${date_time}" -input ${INPUT} -output ${OUTPUT} -coalesce 200 -partition 10000

if [[ $? -ne 0 ]]; then
    exit 255
fi