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

source ../dmp_env.sh

today=${ScheduleTime}

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

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

wang-jinfeng committed
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
part_num=$(hadoop fs -ls s3://mob-emr-test/dataplatform/rtdmp_pre/${date_path}/ | wc -l)
if [[ ${part_num} -le 50 ]]; then
  echo "This Dir No Data !!!"
  partition=10
  coalesce=10
  executor=2
  memory=4
  core=2
  flag=0
else
  partition=2000
  coalesce=200
  executor=8
  memory=10
  core=4
  flag=1
fi
wang-jinfeng committed
28 29
INPUT="s3://mob-emr-test/dataplatform/rtdmp_pre/${date_path}"

wang-jinfeng committed
30
OUTPUT="s3://mob-emr-test/dataplatform/rtdmp_deal/${date_path}"
wang-jinfeng committed
31

wang-jinfeng committed
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
before_date_path=$(date +%Y/%m/%d/%H -d "-2 hour $today")

BEFORE_OUTPUT="s3://mob-emr-test/dataplatform/rtdmp/${before_date_path}"

check_await "${BEFORE_OUTPUT}/_SUCCESS"

spark-submit --class mobvista.dmp.datasource.rtdmp.RTDmpMain \
  --name "RTDmpMain.${date_time}" \
  --conf spark.sql.shuffle.partitions=${partition} \
  --conf spark.default.parallelism=${partition} \
  --conf spark.kryoserializer.buffer.max=512m \
  --conf spark.kryoserializer.buffer=64m \
  --master yarn --deploy-mode cluster \
  --executor-memory ${memory}g --driver-memory 6g --executor-cores ${core} --num-executors ${executor} \
  .././DMP.jar \
  -flag ${flag} -time ${date_time} -input ${INPUT} -output ${OUTPUT} -coalesce ${coalesce}
wang-jinfeng committed
48 49

if [[ $? -ne 0 ]]; then
wang-jinfeng committed
50 51
  exit 255
fi