fix: face_cluster guard checks both global OUTPUT_DIR and demo subdirectory for face_traced.json
Cross-Project Integration / integration (push) Has been cancelled
Core Test / lint-and-test (push) Has been cancelled

This commit is contained in:
Accusys
2026-11-17 01:29:28 +08:00
parent 75cbaa3302
commit db790e2c89
+15 -13
View File
@@ -2426,16 +2426,20 @@ async fn process_job(&self, job: crate::core::db::MonitorJob) -> Result<()> {
// Without it, clustering produces no_faces even when faces were detected // Without it, clustering produces no_faces even when faces were detected
// (the trace file is produced later by store_traced_faces.py in P2 trigger). // (the trace file is produced later by store_traced_faces.py in P2 trigger).
if *processor_type == crate::core::db::ProcessorType::FaceCluster { if *processor_type == crate::core::db::ProcessorType::FaceCluster {
let traced_path = format!( // Per-library output directory (supports both global and demo subdirectory)
"{}/{}.face_traced.json", let output_base = crate::core::config::OUTPUT_DIR
crate::core::config::OUTPUT_DIR .as_str()
.as_str() .trim_end_matches('/');
.trim_end_matches('/'), // Check both global and demo subdirectory for face_traced.json
job.uuid let traced_paths = [
); format!("{}/{}.face_traced.json", output_base, job.uuid),
// ✅ V2: Validate file integrity, not just existence format!("{}/demo/{}.face_traced.json", output_base, job.uuid),
let trace_complete = if std::path::Path::new(&traced_path).exists() { ];
if let Ok(content) = std::fs::read_to_string(&traced_path) { let trace_complete = traced_paths.iter().any(|traced_path| {
if !std::path::Path::new(traced_path).exists() {
return false;
}
if let Ok(content) = std::fs::read_to_string(traced_path) {
if let Ok(traced_data) = serde_json::from_str::<serde_json::Value>(&content) { if let Ok(traced_data) = serde_json::from_str::<serde_json::Value>(&content) {
let frames = traced_data.get("frames"); let frames = traced_data.get("frames");
frames.map_or(false, |f| match f { frames.map_or(false, |f| match f {
@@ -2449,9 +2453,7 @@ async fn process_job(&self, job: crate::core::db::MonitorJob) -> Result<()> {
} else { } else {
false false
} }
} else { });
false
};
if !trace_complete { if !trace_complete {
info!( info!(