|
|
@@ -186,16 +186,16 @@ def collect_processed_files(results: List[Dict[str, Any]]) -> List[Tuple[str, st
|
|
|
...
|
|
|
}
|
|
|
"""
|
|
|
- pid_output_file = Path(result["output_dir"]) / f"process_{result['process_id']}" / f"process_{result['process_id']}.json"
|
|
|
+ pid_output_file = Path(result.get("output_dir", "")) / f"process_{result['process_id']}.json"
|
|
|
if not pid_output_file.exists():
|
|
|
print(f"⚠️ Warning: Output file not found for process {result['process_id']}: {pid_output_file}")
|
|
|
if not result.get("success", False):
|
|
|
# 整个进程失败的情况
|
|
|
process_failed_files = result.get("failed_files", [])
|
|
|
processed_files.extend([(f, "fail") for f in process_failed_files if f])
|
|
|
-
|
|
|
- pid_files = collect_pid_files(str(pid_output_file))
|
|
|
- processed_files.extend(pid_files)
|
|
|
+ else:
|
|
|
+ pid_files = collect_pid_files(str(pid_output_file))
|
|
|
+ processed_files.extend(pid_files)
|
|
|
|
|
|
return processed_files
|
|
|
|
|
|
@@ -273,6 +273,11 @@ def run_single_process(args: Tuple[List[str], Dict[str, Any], int]) -> Dict[str,
|
|
|
"process_id": process_id,
|
|
|
"success": False,
|
|
|
"error": f"Process failed with return code {result.returncode}",
|
|
|
+ "processing_time": processing_time,
|
|
|
+ "file_count": len(file_chunk),
|
|
|
+ "device": config["device"],
|
|
|
+ "output_dir": str(process_output_dir),
|
|
|
+ "failed_files": [str(f) for f in file_chunk],
|
|
|
"stdout": result.stdout,
|
|
|
"stderr": result.stderr
|
|
|
}
|
|
|
@@ -282,14 +287,20 @@ def run_single_process(args: Tuple[List[str], Dict[str, Any], int]) -> Dict[str,
|
|
|
return {
|
|
|
"process_id": process_id,
|
|
|
"success": False,
|
|
|
- "error": "Process timeout"
|
|
|
+ "error": "Process timeout",
|
|
|
+ "device": config["device"],
|
|
|
+ "output_dir": str(process_output_dir),
|
|
|
+ "failed_files": [str(f) for f in file_chunk]
|
|
|
}
|
|
|
except Exception as e:
|
|
|
print(f"Process {process_id} error: {e}")
|
|
|
return {
|
|
|
"process_id": process_id,
|
|
|
"success": False,
|
|
|
- "error": str(e)
|
|
|
+ "error": str(e),
|
|
|
+ "device": config["device"],
|
|
|
+ "output_dir": str(process_output_dir),
|
|
|
+ "failed_files": [str(f) for f in file_chunk]
|
|
|
}
|
|
|
finally:
|
|
|
# 清理临时文件
|