zhangbo 9 månader sedan
förälder
incheckning
27fa05d56b
1 ändrade filer med 5 tillägg och 3 borttagningar
  1. 5 3
      write_redis/alg_recsys_rank_item_realtime_1h.py

+ 5 - 3
write_redis/alg_recsys_rank_item_realtime_1h.py

@@ -29,6 +29,8 @@ redis_helper = RedisHelper()
 
 REDIS_PREFIX = "item_rt_fea_1h_"
 EXPIRE_TIME = 24 * 3600
+TIME_LIMIT_TABLE = 1
+TIME_LIMIT_TASK = 2
 
 def worker(queue, executor):
     while True:
@@ -189,7 +191,7 @@ def main():
     begin_ts = int(time.time())
     table_data_cnt = 0
     while run_flag:
-        if int(time.time()) - begin_ts >= 60 * 40:
+        if int(time.time()) - begin_ts >= 60 * TIME_LIMIT_TABLE:
             log_.info("等待上游数据超过40分钟了,认为失败退出:过了{}秒。".format(int(time.time()) - begin_ts))
             sys.exit(1)
         table_data_cnt = check_data(project, table, partition)
@@ -213,7 +215,7 @@ if __name__ == '__main__':
     process = Process(target=main)
     process.start()
     # 等待子进程完成或超时
-    timeout = 3600
+    timeout = 60 * TIME_LIMIT_TASK
     process.join(timeout=timeout)  # 设置超时为3600秒(1小时)
     if process.is_alive():
         print("脚本执行时间超过1小时,执行失败,经过了{}秒。".format(timeout))
@@ -226,4 +228,4 @@ if __name__ == '__main__':
 
 
 # cd /root/zhangbo/rov-offline
-# python alg_recsys_rank_item_realtime_1h.py 20240117 20
+# python alg_recsys_rank_item_realtime_1h.py 20240702 14