fix: face_cluster guard checks both global OUTPUT_DIR and demo subdirectory for face_traced.json
This commit is contained in:
+15
-13
@@ -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
|
||||
// (the trace file is produced later by store_traced_faces.py in P2 trigger).
|
||||
if *processor_type == crate::core::db::ProcessorType::FaceCluster {
|
||||
let traced_path = format!(
|
||||
"{}/{}.face_traced.json",
|
||||
crate::core::config::OUTPUT_DIR
|
||||
.as_str()
|
||||
.trim_end_matches('/'),
|
||||
job.uuid
|
||||
);
|
||||
// ✅ V2: Validate file integrity, not just existence
|
||||
let trace_complete = if std::path::Path::new(&traced_path).exists() {
|
||||
if let Ok(content) = std::fs::read_to_string(&traced_path) {
|
||||
// Per-library output directory (supports both global and demo subdirectory)
|
||||
let output_base = crate::core::config::OUTPUT_DIR
|
||||
.as_str()
|
||||
.trim_end_matches('/');
|
||||
// Check both global and demo subdirectory for face_traced.json
|
||||
let traced_paths = [
|
||||
format!("{}/{}.face_traced.json", output_base, job.uuid),
|
||||
format!("{}/demo/{}.face_traced.json", output_base, job.uuid),
|
||||
];
|
||||
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) {
|
||||
let frames = traced_data.get("frames");
|
||||
frames.map_or(false, |f| match f {
|
||||
@@ -2449,9 +2453,7 @@ async fn process_job(&self, job: crate::core::db::MonitorJob) -> Result<()> {
|
||||
} else {
|
||||
false
|
||||
}
|
||||
} else {
|
||||
false
|
||||
};
|
||||
});
|
||||
|
||||
if !trace_complete {
|
||||
info!(
|
||||
|
||||
Reference in New Issue
Block a user