3s_tracking_install_total_orc.sh 1.68 KB
Newer Older
wang-jinfeng committed
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
#!/bin/bash

source ../dmp_env.sh

LOG_TIME=$(date +%Y%m%d -d "-1 day $ScheduleTime")
year=${LOG_TIME:0:4}
month=${LOG_TIME:4:2}
day=${LOG_TIME:6:2}

YESTERDAY=$(date -d "$ScheduleTime 2 days ago" "+%Y%m%d")
old_year=${YESTERDAY:0:4}
old_month=${YESTERDAY:4:2}
old_day=${YESTERDAY:6:2}

business="3s"

DAILY_INPUT="${INSTALL_DAILY_3S}/${year}/${month}/${day}/"
check_await "${DAILY_INPUT}/_SUCCESS"

sleep 60

INPUT_PATH="${DMP_INSTALL_LIST}/${old_year}/${old_month}/${old_day}/$business"

check_await "${INPUT_PATH}/_SUCCESS"

OUTPUT="${DMP_INSTALL_LIST}/${year}/${month}/${day}/${business}"

WangJinfeng committed
28 29
mount_partition "dmp_install_list" "dt='$LOG_TIME', business='$business'" "$OUTPUT"

wang-jinfeng committed
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
expire_date=$(date +%Y%m%d -d "-4 day $LOG_TIME")
expire_date_path=$(date +"%Y/%m/%d" -d "-4 day ${LOG_TIME}")
EXPIRE_OUTPUT_PATH="${DMP_INSTALL_LIST}/${expire_date_path}/${business}"

# --conf spark.shuffle.memoryFraction=0.4 \
# --conf spark.storage.memoryFraction=0.4 \
# --conf spark.driver.extraJavaOptions="-XX:+UseG1GC" \
spark-submit --class mobvista.dmp.common.InstallListLogic \
     --name "DmpInstallList.${business}.${LOG_TIME}" \
     --conf spark.sql.shuffle.partitions=20 \
     --conf spark.default.parallelism=20 \
     --conf spark.kryoserializer.buffer.max=256m \
     --conf spark.executor.extraJavaOptions="-XX:+UseG1GC" \
     --master yarn --deploy-mode cluster --executor-memory 4g --driver-memory 4g  --executor-cores 2  --num-executors 5 \
     ../${JAR} -date ${LOG_TIME} -business ${business} -output ${OUTPUT} -coalesce 10

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

# 删除过期的分区及删除对应路径
unmount_partition "dmp_install_list" "dt='${expire_date}', business='${business}'" "${EXPIRE_OUTPUT_PATH}"