#!/bin/bash

run_mode=""
if(($#==1))
then
        run_mode=$1
else
        exit -1
fi

if [[ "$run_mode" != "run" ]]
then
        exit -1
fi

set -x
export SPARK_HOME=/opt/apps/SPARK2/spark-2.4.8-hadoop3.2-1.0.8
export PATH=$SPARK_HOME/bin:$PATH
export HADOOP_CONF_DIR=/etc/taihao-apps/hadoop-conf
export JAVA_HOME=/usr/lib/jvm/java-1.8.0

# params
data_date=$(date +%Y%m%d -d "-2 $days day")
start_date=${data_date}
end_date=${data_date}
start_hour=00
end_hour=23
sampleRate=0.01
table=dwd_recsys_alg_sample_all_20250212
savePath=/dw/recommend/model/82_origin_data/

# 1 生产原始数据
echo "$(date +%Y-%m-%d_%H-%M-%S)----------step1------------开始根据${table}生产原始数据"

/opt/apps/SPARK2/spark-2.4.8-hadoop3.2-1.0.8/bin/spark-class2 org.apache.spark.deploy.SparkSubmit \
--class com.aliyun.odps.spark.examples.makedata_recsys_r_rate.makedata_recsys_82_originData_20250221 \
--master yarn --driver-memory 3G --executor-memory 4G --executor-cores 1 --num-executors 16 \
/mnt/disk1/jch/recommend-emr-dataprocess/target/spark-examples-1.0.0-SNAPSHOT-jar-with-dependencies.jar \
table:${table} tablePart:64 \
beginStr:${start_date}${start_hour} endStr:${end_date}${end_hour} \
whatLabel:is_return_n_noself \
fuSampleRate:${sampleRate} \
repartition:8 \
savePath:${savePath} \
