handle_rov.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/sh
  2. set -ex
  3. #partitionDt="$(date -d '1 days ago' +%Y%m%d)"
  4. #partitionHh="14"
  5. #table='alg_recsys_sample_all_test'
  6. table='alg_recsys_sample_all'
  7. beginStr=2024070400
  8. endStr=2024070423
  9. # 0 判断上游表是否生产完成,最长等待到12点
  10. source /root/anaconda3/bin/activate py37
  11. max_hour=11
  12. max_minute=00
  13. echo "开始校验是否生产完数据,分区信息:beginStr:${beginStr},endStr:${endStr}"
  14. while true; do
  15. python_return_code=$(python checkHiveDataUtil.py --table ${table} --beginStr ${beginStr} --endStr ${endStr})
  16. echo "python 返回值:${python_return_code}"
  17. if [ $python_return_code -eq 0 ]; then
  18. echo "Python程序返回0,校验存在数据,退出循环。"
  19. break
  20. fi
  21. echo "Python程序返回非0值,不存在数据,等待五分钟后再次调用。"
  22. sleep 300
  23. current_hour=$(date +%H)
  24. current_minute=$(date +%M)
  25. if (( current_hour > max_hour || (current_hour == max_hour && current_minute >= max_minute) )); then
  26. echo "最长等待时间已到,失败:${current_hour}-${current_minute}"
  27. exit 1
  28. fi
  29. done
  30. # 1 生产原始数据
  31. #nohup /opt/apps/SPARK2/spark-2.4.8-hadoop3.2-1.0.8/bin/spark-class2 org.apache.spark.deploy.SparkSubmit \
  32. #--class com.aliyun.odps.spark.examples.makedata.makedata_13_originData_20240529 \
  33. #--master yarn --driver-memory 1G --executor-memory 2G --executor-cores 1 --num-executors 16 \
  34. #./target/spark-examples-1.0.0-SNAPSHOT-shaded.jar \
  35. #tablePart:64 repartition:32 \
  36. #beginStr:${beginStr} endStr:${endStr} \
  37. #savePath:/dw/recommend/model/13_sample_data/ \
  38. #table:${beginStr} \
  39. #> p13_2024061600.log 2>&1 &