job_redis_data.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import datetime
  2. import schedule
  3. from common.redis import install_video_data
  4. def bot_video_ai_top():
  5. """头部"""
  6. dt = datetime.datetime.now().strftime('%Y%m%d')
  7. dt = '20241014'
  8. redis_task = 'task:video_ai'
  9. table_name = 'content_ai_tag_return_top'
  10. install_video_data(dt, redis_task, table_name)
  11. def bot_video_ai_recommend():
  12. """新推荐"""
  13. dt = datetime.datetime.now().strftime('%Y%m%d%H')
  14. dt = '2024101514'
  15. redis_task = 'task:video_ai'
  16. table_name = 'content_ai_tag_recommend'
  17. install_video_data(dt, redis_task, table_name)
  18. def bot_video_ai_complex_mode():
  19. """复推"""
  20. dt = datetime.datetime.now().strftime('%Y%m%d%H')
  21. dt = '2024101514'
  22. redis_task = 'task:video_ai'
  23. table_name = 'content_ai_tag_reflowpool'
  24. install_video_data(dt, redis_task, table_name)
  25. # def schedule_tasks():
  26. # # 每小时第1分钟执行
  27. # schedule.every().hour.at(":01").do(video_ai_complex_mode)
  28. # schedule.every().hour.at(":01").do(bot_video_ai_recommend)
  29. #
  30. # # 每天 00:10 执行
  31. # schedule.every().day.at("00:10").do(bot_video_ai_top)
  32. if __name__ == "__main__":
  33. # schedule_tasks() # 调用任务调度函数
  34. # while True:
  35. # schedule.run_pending()
  36. # time.sleep( 1 ) # 每秒钟检查一次
  37. bot_video_ai_top()
  38. bot_video_ai_recommend()
  39. bot_video_ai_complex_mode()