25_xgb_make_data_origin_bucket.sh 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. #!/bin/sh
  2. set -x
  3. export PATH=$SPARK_HOME/bin:$PATH
  4. export HADOOP_CONF_DIR=/etc/taihao-apps/hadoop-conf
  5. export JAVA_HOME=/usr/lib/jvm/java-1.8.0
  6. export SPARK_HOME=/opt/apps/SPARK2/spark-2.4.8-hadoop3.2-1.0.8
  7. sh_path=$(dirname $0)
  8. source ${sh_path}/00_common.sh
  9. source /root/anaconda3/bin/activate py37
  10. make_origin_data() {
  11. local step_start_time=$(date +%s)
  12. /opt/apps/SPARK2/spark-2.4.8-hadoop3.2-1.0.8/bin/spark-class2 org.apache.spark.deploy.SparkSubmit \
  13. --class com.aliyun.odps.spark.examples.makedata_ad.v20240718.makedata_ad_31_originData_20250110 \
  14. --master yarn --driver-memory 1G --executor-memory 2G --executor-cores 1 --num-executors 16 \
  15. ./target/spark-examples-1.0.0-SNAPSHOT-shaded.jar \
  16. tablePart:64 repartition:32 \
  17. beginStr:${today_early_1}00 endStr:${today_early_1}12 \
  18. savePath:${TRAIN_PATH} \
  19. table:${TABLE} \
  20. filterHours:00,01,02,03,04,05,06,07 \
  21. idDefaultValue:0.1 &
  22. local task1=$!
  23. /opt/apps/SPARK2/spark-2.4.8-hadoop3.2-1.0.8/bin/spark-class2 org.apache.spark.deploy.SparkSubmit \
  24. --class com.aliyun.odps.spark.examples.makedata_ad.v20240718.makedata_ad_31_originData_20250110 \
  25. --master yarn --driver-memory 1G --executor-memory 2G --executor-cores 1 --num-executors 16 \
  26. ./target/spark-examples-1.0.0-SNAPSHOT-shaded.jar \
  27. tablePart:64 repartition:32 \
  28. beginStr:${today_early_1}13 endStr:${today_early_1}18 \
  29. savePath:${TRAIN_PATH} \
  30. table:${TABLE} \
  31. filterHours:00,01,02,03,04,05,06,07 \
  32. idDefaultValue:0.1 &
  33. local task2=$!
  34. /opt/apps/SPARK2/spark-2.4.8-hadoop3.2-1.0.8/bin/spark-class2 org.apache.spark.deploy.SparkSubmit \
  35. --class com.aliyun.odps.spark.examples.makedata_ad.v20240718.makedata_ad_31_originData_20250110 \
  36. --master yarn --driver-memory 1G --executor-memory 2G --executor-cores 1 --num-executors 16 \
  37. ./target/spark-examples-1.0.0-SNAPSHOT-shaded.jar \
  38. tablePart:64 repartition:32 \
  39. beginStr:${today_early_1}19 endStr:${today_early_1}23 \
  40. savePath:${TRAIN_PATH} \
  41. table:${TABLE} \
  42. filterHours:00,01,02,03,04,05,06,07 \
  43. idDefaultValue:0.1 &
  44. local task3=$!
  45. wait ${task1}
  46. local task1_return_code=$?
  47. wait ${task2}
  48. local task2_return_code=$?
  49. wait ${task3}
  50. local task3_return_code=$?
  51. check_run_status ${task1_return_code} ${step_start_time} "spark原始样本生产任务: 生产00~12数据异常"
  52. check_run_status ${task2_return_code} ${step_start_time} "spark原始样本生产任务: 生产13~18数据异常"
  53. check_run_status ${task3_return_code} ${step_start_time} "spark原始样本生产任务: 生产19~23数据异常"
  54. }
  55. make_bucket_feature() {
  56. local step_start_time=$(date +%s)
  57. /opt/apps/SPARK2/spark-2.4.8-hadoop3.2-1.0.8/bin/spark-class2 org.apache.spark.deploy.SparkSubmit \
  58. --class com.aliyun.odps.spark.examples.makedata_ad.v20240718.makedata_ad_33_bucketData_20250110 \
  59. --master yarn --driver-memory 2G --executor-memory 3G --executor-cores 1 --num-executors 16 \
  60. ./target/spark-examples-1.0.0-SNAPSHOT-shaded.jar \
  61. beginStr:${today_early_1} endStr:${today_early_1} repartition:64 \
  62. filterNames:_4h_,_5h_,adid_,targeting_conversion_ \
  63. bucketFileName:20250217_ad_bucket_688.txt \
  64. readPath:${TRAIN_PATH} \
  65. savePath:${BUCKET_FEATURE_PATH}
  66. local return_code=$?
  67. check_run_status ${return_code} ${step_start_time} "spark特征分桶任务"
  68. }
  69. make_bucket_feature_to_hive() {
  70. local step_start_time=$(date +%s)
  71. /opt/apps/SPARK2/spark-2.4.8-hadoop3.2-1.0.8/bin/spark-class2 org.apache.spark.deploy.SparkSubmit \
  72. --class com.aliyun.odps.spark.examples.makedata_ad.v20240718.makedata_ad_33_bucketDataToHive_20250110 \
  73. --master yarn --driver-memory 2G --executor-memory 3G --executor-cores 1 --num-executors 16 \
  74. ./target/spark-examples-1.0.0-SNAPSHOT-shaded.jar \
  75. beginStr:${today_early_1} endStr:${today_early_1} repartition:64 \
  76. filterNames:_4h_,_5h_,adid_,targeting_conversion_ \
  77. table:ad_easyrec_eval_data_v2_sampled \
  78. partition:"dt=${today_early_1}" \
  79. readPath:${TRAIN_PATH} \
  80. negSampleRate:0.04
  81. local return_code=$?
  82. check_run_status ${return_code} ${step_start_time} "spark特征分桶任务"
  83. }
  84. make_bucket_feature_from_origin_to_hive() {
  85. local step_start_time=$(date +%s)
  86. neg_sample_rate=${NEG_SAMPLE_RATE:-0.04}
  87. /opt/apps/SPARK2/spark-2.4.8-hadoop3.2-1.0.8/bin/spark-class2 org.apache.spark.deploy.SparkSubmit \
  88. --class com.aliyun.odps.spark.examples.makedata_ad.v20240718.makedata_ad_33_bucketDataFromOriginToHive_20250228 \
  89. --master yarn --driver-memory 2G --executor-memory 3G --executor-cores 1 --num-executors 30 \
  90. ./target/spark-examples-1.0.0-SNAPSHOT-shaded.jar \
  91. beginStr:${today_early_1} endStr:${today_early_1} \
  92. filterHours:${FILTER_HOURS:-00,01,02,03,04,05,06,07} \
  93. filterAdverIds:${FILTER_ADVER_IDS} \
  94. filterNames:_4h_,_5h_,adid_,targeting_conversion_ \
  95. outputTable:${outputTable} \
  96. inputTable:alg_recsys_ad_sample_all \
  97. negSampleRate:${neg_sample_rate}
  98. local return_code=$?
  99. check_run_status ${return_code} ${step_start_time} "spark特征分桶任务"
  100. }