#!/usr/bin/env bash


source ../../dmp_env.sh

LOG_TIME=$(date -d "$ScheduleTime" +"%Y%m%d")
date_path=$(date -d "$ScheduleTime" +"%Y/%m/%d")

IMEIMD5_OUTPUT_PATH="${UC_LAHUO_DAILY_TMP_PATH}/$date_path/imeimd5"
OAIDMD5_OUTPUT_PATH="${UC_LAHUO_DAILY_TMP_PATH}/$date_path/oaidmd5"

hadoop fs -rm -r "${IMEIMD5_OUTPUT_PATH}"
hadoop fs -rm -r "${OAIDMD5_OUTPUT_PATH}"

spark-submit --class mobvista.dmp.datasource.taobao.UCLaHuoDF \
     --name "UCLaHuoDF.${LOG_TIME}" \
     --conf spark.network.timeout=720s \
     --conf spark.sql.shuffle.partitions=1000 \
     --conf spark.default.parallelism=1000 \
     --conf spark.kryoserializer.buffer.max=256m \
     --conf spark.driver.extraJavaOptions="-XX:+UseG1GC" \
     --conf spark.executor.extraJavaOptions="-XX:+UseG1GC" \
     --files ${HIVE_SITE_PATH} \
     --jars s3://mob-emr-test/wangjf/jar/spark-clickhouse-connector_2.11-2.4.0_0.22.jar \
     --master yarn --deploy-mode cluster --executor-memory 4g --driver-memory 4g  --executor-cores 3  --num-executors 10 \
     ../../${JAR} -date ${LOG_TIME} -partNum 10 -imeiOutput ${IMEIMD5_OUTPUT_PATH}  -oaidOutput ${OAIDMD5_OUTPUT_PATH}  -cluster 'cluster_1st'

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