handle_rov.sh 1.5 KB

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