feat: trace-level matching, health watcher/worker status, timezone config
This commit is contained in:
@@ -237,11 +237,19 @@ impl ProcessorPool {
|
||||
let key = format!("{}job:{}:processor:{}", prefix, &job.uuid, &processor_name);
|
||||
let now = chrono::Utc::now().to_rfc3339();
|
||||
let _: Option<String> = redis::cmd("HSET")
|
||||
.arg(&key).arg("started_at").arg(&now)
|
||||
.query_async(&mut conn).await.ok();
|
||||
.arg(&key)
|
||||
.arg("started_at")
|
||||
.arg(&now)
|
||||
.query_async(&mut conn)
|
||||
.await
|
||||
.ok();
|
||||
let _: Option<String> = redis::cmd("HSET")
|
||||
.arg(&key).arg("embedding_started_at").arg(&now)
|
||||
.query_async(&mut conn).await.ok();
|
||||
.arg(&key)
|
||||
.arg("embedding_started_at")
|
||||
.arg(&now)
|
||||
.query_async(&mut conn)
|
||||
.await
|
||||
.ok();
|
||||
}
|
||||
|
||||
// Subscribe to Redis progress pub/sub and update processor hash in real-time
|
||||
@@ -254,10 +262,12 @@ impl ProcessorPool {
|
||||
let cb_processor = sub_processor.clone();
|
||||
if let Err(e) = sub_redis
|
||||
.subscribe_and_callback(&sub_uuid, move |msg| {
|
||||
tracing::info!("[Subscriber] Got msg for={} cur={} tot={}",
|
||||
msg.processor,
|
||||
tracing::info!(
|
||||
"[Subscriber] Got msg for={} cur={} tot={}",
|
||||
msg.processor,
|
||||
msg.data.current.unwrap_or(0),
|
||||
msg.data.total.unwrap_or(0));
|
||||
msg.data.total.unwrap_or(0)
|
||||
);
|
||||
if msg.processor == cb_processor {
|
||||
let cur = msg.data.current.unwrap_or(0);
|
||||
let tot = msg.data.total.unwrap_or(0);
|
||||
@@ -266,11 +276,18 @@ impl ProcessorPool {
|
||||
let u = cb_uuid.clone();
|
||||
let p = cb_processor.clone();
|
||||
tokio::spawn(async move {
|
||||
match r.update_worker_processor_status(
|
||||
&u, &p, "running", None,
|
||||
cur, oc, tot, 0, 0,
|
||||
).await {
|
||||
Ok(_) => tracing::info!("[Subscriber] Updated {}: cur={} tot={}", p, cur, tot),
|
||||
match r
|
||||
.update_worker_processor_status(
|
||||
&u, &p, "running", None, cur, oc, tot, 0, 0,
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(_) => tracing::info!(
|
||||
"[Subscriber] Updated {}: cur={} tot={}",
|
||||
p,
|
||||
cur,
|
||||
tot
|
||||
),
|
||||
Err(e) => tracing::error!("[Subscriber] FAILED {}: {}", p, e),
|
||||
}
|
||||
});
|
||||
@@ -756,9 +773,11 @@ impl ProcessorPool {
|
||||
.enumerate()
|
||||
.map(|(i, segment)| {
|
||||
// Prefer ASR output frames, fallback to time-based conversion
|
||||
let start_frame = segment.start_frame
|
||||
let start_frame = segment
|
||||
.start_frame
|
||||
.unwrap_or_else(|| (segment.start_time * fps).round() as i64);
|
||||
let end_frame = segment.end_frame
|
||||
let end_frame = segment
|
||||
.end_frame
|
||||
.unwrap_or_else(|| (segment.end_time * fps).round() as i64);
|
||||
let data = serde_json::json!({
|
||||
"text": segment.text,
|
||||
@@ -892,7 +911,11 @@ impl ProcessorPool {
|
||||
tracing::info!(
|
||||
"Storing {} Face pre-chunks + {} detections for video {}",
|
||||
frames_count,
|
||||
face_result.frames.iter().map(|f| f.faces.len()).sum::<usize>(),
|
||||
face_result
|
||||
.frames
|
||||
.iter()
|
||||
.map(|f| f.faces.len())
|
||||
.sum::<usize>(),
|
||||
uuid
|
||||
);
|
||||
|
||||
@@ -911,7 +934,10 @@ impl ProcessorPool {
|
||||
detections_to_store.push((
|
||||
frame.frame as i64,
|
||||
frame.timestamp,
|
||||
face.x, face.y, face.width, face.height,
|
||||
face.x,
|
||||
face.y,
|
||||
face.width,
|
||||
face.height,
|
||||
face.confidence,
|
||||
));
|
||||
}
|
||||
@@ -1170,9 +1196,10 @@ impl ProcessorPool {
|
||||
"top_5": scene.top_5,
|
||||
});
|
||||
let chunk_table = crate::core::db::schema::table_name("chunk");
|
||||
let _ = sqlx::query(
|
||||
&format!("UPDATE {} SET metadata = metadata || $1::jsonb WHERE file_uuid=$2 AND chunk_id=$3", chunk_table)
|
||||
)
|
||||
let _ = sqlx::query(&format!(
|
||||
"UPDATE {} SET metadata = metadata || $1::jsonb WHERE file_uuid=$2 AND chunk_id=$3",
|
||||
chunk_table
|
||||
))
|
||||
.bind(&meta)
|
||||
.bind(uuid)
|
||||
.bind(&chk_id)
|
||||
|
||||
Reference in New Issue
Block a user