LingxinMeng 7 miesięcy temu
rodzic
commit
d7be76b0d1
1 zmienionych plików z 6 dodań i 1 usunięć
  1. 6 1
      src/python2/pjisuv/callback-pjisuv.py

+ 6 - 1
src/python2/pjisuv/callback-pjisuv.py

@@ -19,6 +19,7 @@ url2_private = "http://10.14.86.127:9081/device/data/callback"
 
 error_bag_json = "/mnt/disk001/dcl_data_process/src/python2/pjisuv/callback-errorBag.json"
 
+
 def parse_json_to_string_array(file_path):
     try:
         # 打开并读取JSON文件(Python 2中不支持encoding参数,需要使用codecs模块或处理文件读取后的编码)
@@ -58,6 +59,7 @@ def list_to_json_file(data, file_path):
         # 将UTF-8编码的JSON字符串写入文件
         file.write(json_data_utf8)
 
+
 def add_hour(date_string, hour_number):
     original_date = datetime.strptime(date_string, "%Y-%m-%d-%H-%M-%S")
     new_date = original_date + timedelta(hours=hour_number)
@@ -121,6 +123,9 @@ if __name__ == '__main__':
 
                 if not callback_json or not camera_mp4 or not drive_csv or not pcd_forwardlook_mp4 or not pcd_overlook_mp4 or not pos_orig_csv or not scenario_orig_mp4 or not scenario_orig_xosc:
                     continue
+                error_bag_list = parse_json_to_string_array(error_bag_json)
+                if str(obj1.key) in error_bag_list:
+                    continue
                 time.sleep(2)
                 logging.info("发送: %s" % str(obj1.key))
                 # 1 获取json内容
@@ -190,7 +195,7 @@ if __name__ == '__main__':
                         bucket.batch_delete_objects(old_delete_list)
                     except Exception as e:
                         error_bag_list = parse_json_to_string_array(error_bag_json)
-                        error_bag_list.append(parse_prefix)
+                        error_bag_list.append(str(obj1.key))
                         list_to_json_file(error_bag_list, error_bag_json)
                         continue