run_shipinhao_recommend.py 767 B

12345678910111213141516171819202122232425262728
  1. # -*- coding: utf-8 -*-
  2. # @Author: wangkun
  3. # @Time: 2022/10/27
  4. import datetime
  5. import os
  6. import sys
  7. import time
  8. sys.path.append(os.getcwd())
  9. from main.common import Common
  10. from shipinhao.shipinhao_recommend import Recommend
  11. class Main:
  12. @classmethod
  13. def main(cls, env):
  14. while True:
  15. if 22 >= datetime.datetime.now().hour >= 10:
  16. Recommend.run_recommend('recommend', env)
  17. Common.del_logs('recommend')
  18. Common.logger('recommend').info('休眠{}小时\n', 24 - datetime.datetime.now().hour)
  19. Recommend.download_cnt = []
  20. time.sleep(3600 * (24 - datetime.datetime.now().hour))
  21. else:
  22. pass
  23. if __name__ == '__main__':
  24. Main.main('prod')