feat: declarative pipeline config, non-blocking Scene VLM, rust_asrx
Consolidated snapshot (previously WIP in working tree). - core/pipeline_config: new module loading config/pipeline_flows.json as the source of truth for stage execution mode (parallel/blocking) and dependencies - worker/job_worker: dispatch Scene VLM to a background task when the stage is declared parallel, unblocking the worker poll loop; resolve processor dependencies from pipeline_flows.json (fallback to built-in) - config/pipeline_flows.json: asrx depends on [cut, asr] - scripts/fix_stuck_jobs: fix UTC timezone comparison, raise default threshold to 6h, skip jobs with recent processor activity - rust_asrx: Rust speaker diarization CLI + processor wiring - processor metadata helper; fast_face_clustering script; file_progress pipeline API; scan API; VAD updates
This commit is contained in:
+113
@@ -1317,6 +1317,7 @@ pub fn scan_routes() -> Router<AppState> {
|
||||
get(get_ingestion_status),
|
||||
)
|
||||
.route("/api/v1/stats/file/:file_uuid", get(get_file_stats))
|
||||
.route("/api/v1/file/:file_uuid/scene-vlm-stats", get(get_scene_vlm_stats))
|
||||
.route(
|
||||
"/api/v1/stats/pipeline/:file_uuid",
|
||||
get(get_pipeline_progress_handler),
|
||||
@@ -1517,6 +1518,62 @@ async fn get_pipeline_progress_handler(
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
// Check scene_vlm progress from scenes.json
|
||||
let output_dir = crate::core::config::OUTPUT_DIR.as_str();
|
||||
let scenes_path = format!("{}/{}.scenes.json", output_dir, file_uuid);
|
||||
if std::path::Path::new(&scenes_path).exists() {
|
||||
if let Ok(scenes_json) = std::fs::read_to_string(&scenes_path) {
|
||||
if let Ok(scenes_data) = serde_json::from_str::<serde_json::Value>(&scenes_json) {
|
||||
let total_scenes = scenes_data
|
||||
.get("total_scenes")
|
||||
.and_then(|v| v.as_i64())
|
||||
.unwrap_or(0) as i64;
|
||||
|
||||
let vlm_done = scenes_data
|
||||
.get("scenes")
|
||||
.and_then(|v| v.as_array())
|
||||
.map(|arr| {
|
||||
arr.iter()
|
||||
.filter(|s| {
|
||||
let status = s.get("vlm_status").and_then(|v| v.as_str());
|
||||
status == Some("completed") || status == Some("done")
|
||||
})
|
||||
.count() as i64
|
||||
})
|
||||
.unwrap_or(0);
|
||||
|
||||
let scene_vlm_status = if total_scenes == 0 {
|
||||
"completed"
|
||||
} else if vlm_done == total_scenes {
|
||||
"completed"
|
||||
} else if vlm_done > 0 {
|
||||
"running"
|
||||
} else {
|
||||
"pending"
|
||||
};
|
||||
|
||||
let scene_vlm_progress = if total_scenes == 0 {
|
||||
1.0
|
||||
} else if vlm_done > 0 {
|
||||
vlm_done as f64 / total_scenes as f64
|
||||
} else {
|
||||
0.0
|
||||
};
|
||||
|
||||
pp.update_stage(
|
||||
"scene_vlm",
|
||||
scene_vlm_progress,
|
||||
scene_vlm_status,
|
||||
if total_scenes == 0 {
|
||||
Some("no scenes".to_string())
|
||||
} else {
|
||||
Some(format!("{}/{}", vlm_done, total_scenes))
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Check face dedup from actual face_cluster.json content
|
||||
// Always check if processors_done, regardless of tkg_node_count (A-10 fix)
|
||||
if processors_done {
|
||||
@@ -1585,3 +1642,59 @@ async fn get_pipeline_progress_handler(
|
||||
|
||||
Ok(Json(pp))
|
||||
}
|
||||
|
||||
/// Quick scene VLM stats endpoint (fast, no Qdrant queries)
|
||||
async fn get_scene_vlm_stats(
|
||||
State(state): State<AppState>,
|
||||
Path(file_uuid): Path<String>,
|
||||
) -> Result<Json<SceneVlmStats>, StatusCode> {
|
||||
let output_dir = crate::core::config::OUTPUT_DIR.to_string();
|
||||
let scenes_path = format!("{}/{}.scenes.json", output_dir, file_uuid);
|
||||
|
||||
if !std::path::Path::new(&scenes_path).exists() {
|
||||
return Ok(Json(SceneVlmStats::default()));
|
||||
}
|
||||
|
||||
let scenes_json = std::fs::read_to_string(&scenes_path)
|
||||
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?;
|
||||
|
||||
let scenes_data: serde_json::Value = serde_json::from_str(&scenes_json)
|
||||
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?;
|
||||
|
||||
let total_scenes = scenes_data
|
||||
.get("total_scenes")
|
||||
.and_then(|v| v.as_i64())
|
||||
.unwrap_or(0);
|
||||
|
||||
let status = scenes_data
|
||||
.get("status")
|
||||
.and_then(|v| v.as_str())
|
||||
.unwrap_or("pending")
|
||||
.to_string();
|
||||
|
||||
let scenes_array = scenes_data
|
||||
.get("scenes")
|
||||
.and_then(|v| v.as_array())
|
||||
.map(|arr| arr.len() as i64)
|
||||
.unwrap_or(0);
|
||||
|
||||
let vlm_done = scenes_data
|
||||
.get("scenes")
|
||||
.and_then(|v| v.as_array())
|
||||
.map(|arr| {
|
||||
arr.iter()
|
||||
.filter(|s| {
|
||||
let vlm_status = s.get("vlm_status").and_then(|v| v.as_str());
|
||||
vlm_status == Some("completed") || vlm_status == Some("done")
|
||||
})
|
||||
.count() as i64
|
||||
})
|
||||
.unwrap_or(0);
|
||||
|
||||
Ok(Json(SceneVlmStats {
|
||||
total_scenes: total_scenes.max(scenes_array),
|
||||
status,
|
||||
vlm_done,
|
||||
vlm_total: total_scenes.max(scenes_array),
|
||||
}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user