日志打印配置,识别完成后清理临时目录
This commit is contained in:
parent
401c4eae2f
commit
2a83054687
@ -710,6 +710,7 @@ class YOLOSegmentationInference:
|
|||||||
move_file_shutil(output_dir+".zip", output_dir)
|
move_file_shutil(output_dir+".zip", output_dir)
|
||||||
remote_dir = f"{tmpConfig['dir']}_识别/{task_id}/{current_time}"
|
remote_dir = f"{tmpConfig['dir']}_识别/{task_id}/{current_time}"
|
||||||
scanner.upload_directory(output_dir, config['share'], remote_dir=remote_dir)
|
scanner.upload_directory(output_dir, config['share'], remote_dir=remote_dir)
|
||||||
|
del_file_shutil(output_dir)
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|||||||
@ -891,6 +891,28 @@ def move_file_shutil(source_path, destination_path):
|
|||||||
print(f"移动失败: {e}")
|
print(f"移动失败: {e}")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def del_file_shutil(path):
|
||||||
|
"""
|
||||||
|
使用shutil删除文件或文件夹
|
||||||
|
|
||||||
|
Args:
|
||||||
|
path: 文件/文件夹路径
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
# 检查源文件是否存在
|
||||||
|
if not os.path.exists(path):
|
||||||
|
print(f"错误: 文件不存在 - {path}")
|
||||||
|
return False
|
||||||
|
|
||||||
|
# 执行删除操作
|
||||||
|
shutil.rmtree(path)
|
||||||
|
print(f"成功删除: {path}")
|
||||||
|
return True
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f"删除失败: {e}")
|
||||||
|
return False
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# 配置信息
|
# 配置信息
|
||||||
config = {
|
config = {
|
||||||
|
|||||||
@ -173,6 +173,7 @@ import sys
|
|||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import logging
|
||||||
from typing import Dict, Optional, List, Any
|
from typing import Dict, Optional, List, Any
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
@ -239,6 +240,9 @@ app.config.update({
|
|||||||
"DEBUG": Config.DEBUG,
|
"DEBUG": Config.DEBUG,
|
||||||
"WORKERS": Config.WORKERS
|
"WORKERS": Config.WORKERS
|
||||||
})
|
})
|
||||||
|
# 设置 smbprotocol 的日志级别
|
||||||
|
logging.getLogger("smbprotocol").setLevel(logging.WARNING)
|
||||||
|
logging.getLogger("smbprotocol.open").setLevel(logging.WARNING)
|
||||||
|
|
||||||
# 全局状态
|
# 全局状态
|
||||||
active_tasks: Dict[str, TaskInfo] = {}
|
active_tasks: Dict[str, TaskInfo] = {}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user