#!/bin/sh
source ../dmp_env.sh
## date=$1
## deal_time="";
## year=""
## month=""
## day=""
## if [ "$date" ]; then
## deal_time=$(date +%Y%m%d -d "$date")
## year=$(date +%Y -d "$date")
## month=$(date +%m -d "$date")
## day=$(date +%d -d "$date")
## #cdndate=`date -d "$format_day" +%Y%m%d`
## echo "$deal_time"
## else
## #echo "dfdf"
## deal_time=$(date -d "$ScheduleTime 1 days ago" +"%Y%m%d")
## year=$(date -d "$ScheduleTime 1 days ago" +"%Y")
## month=$(date -d "$ScheduleTime 1 days ago" +"%m")
## day=$(date -d "$ScheduleTime 1 days ago" +"%d")
## echo "$deal_time"
## fi

date_path=$(date -d "$ScheduleTime 1 days ago" +"%Y/%m/%d")
deal_time=$(date -d "$ScheduleTime 1 days ago" +"%Y%m%d")

check_await "${GA_DAILY_PATH}/$date_path/_SUCCESS"

echo "$deal_time"
spark-submit --class mobvista.dmp.datasource.event_tag.Ga_purchase_event \
  --conf spark.serializer=org.apache.spark.serializer.KryoSerializer \
  --conf spark.driver.memory=2G \
  --conf spark.shuffle.file.buffer=256k \
  --conf spark.reducer.maxSizeInFlight=100m \
  --conf spark.shuffle.io.maxRetries=60 \
  --conf spark.shuffle.io.retryWait=60s \
  --conf spark.network.timeout=1200 \
  --conf spark.shuffle.compress=true \
  --conf spark.io.compression.codec=lz4 \
  --conf spark.driver.maxResultSize=2024M \
  --conf spark.shuffle.spill.compress=true \
  --name event_tag_daily \
  --conf spark.app.name=event_tag_daily \
  --conf spark.app.db_name=dwh \
  --conf spark.app.table=dmp_event_tag_daily \
  --conf spark.app.loadTime=${deal_time} \
  --conf spark.sql.shuffle.partitions=500 \
  --conf spark.yarn.executor.memoryOverhead=3048 \
  --conf spark.locality.wait=0 \
  --conf spark.shuffle.io.numConnectionsPerPeer=10 \
  --conf spark.shuffle.consolidateFiles=true \
  --conf spark.dynamicAllocation.enabled=false \
  --master yarn --deploy-mode cluster --conf spark.akka.frameSize=100 --num-executors 35 --executor-cores 2 --executor-memory 5G \
  ../${JAR}
