run.sh 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #!/bin/bash
  2. source ~/.bash_profile
  3. source ~/.bashrc
  4. conda activate tf2
  5. cd /data/UserReturn
  6. #1. download data
  7. nowday=`date +"%Y%m%d" -d -0days`
  8. last7day=`date +"%Y%m%d" -d -1days`
  9. nowhour=`date +"%Y%m%d%H" -d -1hours`
  10. echo ${nowday}
  11. echo ${last7day}
  12. mkdir -p ./data/
  13. mkdir -p ./logs/
  14. #conda activate py36
  15. python extract_share_log.py ${last7day} ${nowday}
  16. if [ $? -ne 0 ];
  17. then
  18. msg = "[ERROR] simrecall extract_share_log"
  19. #sh sendmsg.sh $nowday $msg
  20. echo "[ERROR] echo 'extract_share_log"
  21. exit 255
  22. fi
  23. python extract_clik_log.py ${last7day} ${nowday}
  24. if [ $? -ne 0 ];
  25. then
  26. msg = "[ERROR] simrecall extract_share_log"
  27. #sh sendmsg.sh $nowday $msg
  28. echo "[ERROR] echo 'extract_share_log"
  29. exit 255
  30. fi
  31. python groupItem.py ${nowday}
  32. if [ $? -ne 0 ];
  33. then
  34. msg = "[ERROR] simrecall extract_share_log"
  35. #sh sendmsg.sh $nowday $msg
  36. echo "[ERROR] echo 'extract_share_log"
  37. exit 255
  38. fi
  39. python extract_user_exp_video.py ${last7day} ${nowday}
  40. if [ $? -ne 0 ];
  41. then
  42. msg = "[ERROR] simrecall extract_share_log"
  43. #sh sendmsg.sh $nowday $msg
  44. echo "[ERROR] echo 'extract_share_log"
  45. exit 255
  46. fi
  47. python getI2I.py ./data/user_video_exp_${nowday} ./data/return_item_${nowday} ./data/i2i_${nowday}
  48. if [ $? -ne 0 ];
  49. then
  50. msg = "[ERROR] simrecall extract_share_log"
  51. #sh sendmsg.sh $nowday $msg
  52. echo "[ERROR] echo 'extract_share_log"
  53. exit 255
  54. fi
  55. python calReturn.py ${nowday}
  56. if [ $? -ne 0 ];
  57. then
  58. msg = "[ERROR] simrecall extract_share_log"
  59. #sh sendmsg.sh $nowday $msg
  60. echo "[ERROR] echo 'extract_share_log"
  61. exit 255
  62. fi
  63. python getI2ICTRGroup.py ./data/user_video_exp_${nowday} ./data/user_item_return_count_${nowday} ./data/i2i_${nowday} ./data/i2i_group_ctr_${nowday}
  64. if [ $? -ne 0 ];
  65. then
  66. msg = "[ERROR] simrecall extract_share_log"
  67. #sh sendmsg.sh $nowday $msg
  68. echo "[ERROR] echo 'extract_share_log"
  69. exit 255
  70. fi
  71. python import_redist.py ./data/i2i_group_ctr_${nowday} ./data/return_video_rec_${nowday}
  72. python getI2ICTRGroupV2.py ./data/user_video_exp_${nowday} ./data/user_item_return_count_${nowday} ./data/i2i_${nowday} ./data/i2i_group_ctr_v2_${nowday}
  73. if [ $? -ne 0 ];
  74. then
  75. msg = "[ERROR] simrecall extract_share_log"
  76. #sh sendmsg.sh $nowday $msg
  77. echo "[ERROR] echo 'extract_share_log"
  78. exit 255
  79. fi
  80. python import_redist_v2.py ./data/i2i_group_ctr_v2_${nowday} ./data/return_video_rec_v2_${nowday}
  81. day="$(date -d '40 days ago' +%Y-%m-%d)"
  82. pattern="/data/UserReturn/data/*${day}*"
  83. if compgen -G "$pattern" > /dev/null; then
  84. find "$base_path" -name "${day}*" -exec rm -rf {} \;
  85. echo "delete done"
  86. else
  87. echo "no data"
  88. fi