Ver Fonte

测试报警功能

zhangbo há 10 meses atrás
pai
commit
8748d127c9
1 ficheiros alterados com 6 adições e 5 exclusões
  1. 6 5
      write_redis/alg_ad_feature_03_cid2actionv1_redis.py

+ 6 - 5
write_redis/alg_ad_feature_03_cid2actionv1_redis.py

@@ -162,8 +162,8 @@ def main():
     run_flag = table_data_cnt == 0
     begin_ts = int(time.time())
     while run_flag:
-        if int(time.time()) - begin_ts >= 60*5:
-            log_.info("等待上游数据超过50分钟了,认为失败退出:{}".format(int(time.time()) - begin_ts))
+        if int(time.time()) - begin_ts >= 60*50:
+            log_.info("等待上游数据超过50分钟了,认为失败退出:过了{}秒。".format(int(time.time()) - begin_ts))
             exit(999)
         table_data_cnt = check_data(project, table, date, hour, mm)
         if table_data_cnt == 0:
@@ -197,9 +197,10 @@ if __name__ == '__main__':
     process = Process(target=main)
     process.start()
     # 等待子进程完成或超时
-    process.join(timeout=3600)  # 设置超时为3600秒(1小时)
+    timeout = 60
+    process.join(timeout=timeout)  # 设置超时为3600秒(1小时)
     if process.is_alive():
-        print("脚本执行时间超过1小时,执行失败。")
+        print("脚本执行时间超过1小时,执行失败,经过了{}秒。".format(timeout))
         process.terminate()  # 终止子进程
         exit(999)  # 直接退出主进程并返回状态码999
     log_.info("完成执行:" + datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
@@ -207,7 +208,7 @@ if __name__ == '__main__':
 
 
 # cd /root/zhangbo/rov-offline
-# python alg_ad_feature_01_cid2action_redis.py 20240523 19 00
+# python alg_ad_feature_03_cid2actionv1_redis.py 20240605 19 00
 
 """
     !!!!!!!!!!!!!!