Browse Source

报错问题处理

rambo 1 month ago
parent
commit
7507cda4b8
1 changed files with 7 additions and 15 deletions
  1. 7 15
      python/api.py

+ 7 - 15
python/api.py

@@ -356,12 +356,14 @@ async def process_handle_detail(request: Request, params: HandlerDetail):
             )
             
     except UnicornException as e:
-        print("错误信息:", e)
-        print("错误发生在行号:", traceback.extract_tb(e.__traceback__)[0][1])
+        logger.info(f"错误信息:{e}")
+        line = traceback.extract_tb(e.__traceback__)[0][1]
+        logger.info(f"错误发生在行号:{line}")
         await _handle_exception(e.msg, handler_result_folder)
     except Exception as e:
-        print("错误信息:", e)
-        print("错误发生在行号:", traceback.extract_tb(e.__traceback__)[0][1])
+        logger.info(f"错误信息:{e}")
+        line = traceback.extract_tb(e.__traceback__)[0][1]
+        logger.info(f"错误发生在行号:{line}")
         await _handle_exception(str(e), handler_result_folder)
         
     return True
@@ -764,17 +766,7 @@ async def _process_model_images(aigc_clazz, run_main, return_data_check_before_d
                     continue
                     
                 shutil.copy(ceshi_image_path, save_image_path)
-            
-                # 添加超时控制
-                with concurrent.futures.ThreadPoolExecutor() as executor:
-                    future = executor.submit(
-                        aigc_clazz.generateUpperShoes,
-                        save_image_path,
-                        model_id,
-                        save_image_path
-                    )
-                    # 设置70秒超时
-                    image_path = future.result(timeout=80)
+                image_path = aigc_clazz.generateUpperShoes(save_image_path, model_id, save_image_path)
                 
                 goods_art_dict_info_item["模特图"] = image_path
                 new_goods_dict[goods_art_no_info]["货号资料"][idx_key] = goods_art_dict_info_item