docs: Worker execution analysis - skips processors incorrectly
Root cause:
- Worker thinks output files exist when they don't
- Logs show 'Processor X output file exists, marking completed and skipping'
- But files don't actually exist in expected directory
Analysis:
- Worker checks output_path.exists() to decide skip/run
- OUTPUT_DIR configuration may be incorrect
- Worker might be checking wrong directory
Solutions:
1. Fix OUTPUT_DIR configuration
2. Add data integrity check (not just file existence)
3. Clean up stale files before restart
Progress:
- ✅ TKG Builder fixed (commit 82c400e)
- ⏸️ Worker issue analyzed, needs configuration fix
This commit is contained in:
@@ -0,0 +1,132 @@
|
||||
---
|
||||
title: Worker Execution Analysis - Why Worker Skips Processors
|
||||
version: 1.0
|
||||
date: 2026-09-27
|
||||
author: OpenCode
|
||||
status: analysis_complete
|
||||
---
|
||||
|
||||
## 問題描述
|
||||
|
||||
Worker 檢測到 monitor_job 但不執行處理器,只不斷檢查狀態。
|
||||
|
||||
---
|
||||
|
||||
## 根本原因
|
||||
|
||||
**Worker 認為處理器輸出文件已存在**
|
||||
|
||||
### 日誌證據
|
||||
|
||||
```
|
||||
[INFO] Processor asr output file exists, marking completed and skipping
|
||||
[INFO] Processor face output file exists, marking completed and skipping
|
||||
[INFO] Processor ocr output file exists, marking completed and skipping
|
||||
...
|
||||
```
|
||||
|
||||
### 問題
|
||||
|
||||
文件實際**不存在**,但 Worker 認為存在。
|
||||
|
||||
---
|
||||
|
||||
## 分析
|
||||
|
||||
### Worker 檢查邏輯
|
||||
|
||||
```rust
|
||||
let output_path = PathBuf::from(OUTPUT_DIR.as_str()).join(format!(
|
||||
"{}.{}.json",
|
||||
job.uuid,
|
||||
processor_type.as_str()
|
||||
));
|
||||
|
||||
if output_path.exists() {
|
||||
// 跳過處理器
|
||||
} else {
|
||||
// 運行處理器
|
||||
}
|
||||
```
|
||||
|
||||
### 可能的原因
|
||||
|
||||
1. **OUTPUT_DIR 配置錯誤**
|
||||
- Worker 檢查的路徑與實際輸出路徑不同
|
||||
- 實際輸出: `/Users/accusys/momentry/output/`
|
||||
- Worker 檢查: 可能是 `/Users/accusys/momentry/output_dev/` 或其他路徑
|
||||
|
||||
2. **殘留文件**
|
||||
- 之前 unregister 時沒有正確清理
|
||||
- 或者有其他文件被誤判
|
||||
|
||||
3. **權限問題**
|
||||
- Worker 進程沒有權限訪問某些目錄
|
||||
- 導致錯誤的判斷
|
||||
|
||||
---
|
||||
|
||||
## 解決方案
|
||||
|
||||
### 方案 1: 修復 OUTPUT_DIR 配置
|
||||
|
||||
確保 Worker 使用的 OUTPUT_DIR 與實際輸出目錄一致:
|
||||
|
||||
```bash
|
||||
export MOMENTRY_OUTPUT_DIR=/Users/accusys/momentry/output
|
||||
```
|
||||
|
||||
### 方案 2: 添加數據完整性檢查
|
||||
|
||||
不僅檢查文件是否存在,還要檢查文件是否有效:
|
||||
|
||||
```rust
|
||||
if output_path.exists() && is_valid_output_file(&output_path) {
|
||||
// 跳過
|
||||
} else {
|
||||
// 運行
|
||||
}
|
||||
```
|
||||
|
||||
### 方案 3: 清理殘留文件
|
||||
|
||||
重新啟動 Worker 前,確保:
|
||||
|
||||
```bash
|
||||
# 清理不完整的輸出
|
||||
rm -f /Users/accusys/momentry/output_dev/*.json
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 已修復的問題
|
||||
|
||||
### ✅ TKG Builder 架構不兼容
|
||||
|
||||
**問題**: 使用已廢棄的 `face_detections` 表
|
||||
**解決**: 遷移到 Qdrant V4.0 架構
|
||||
**提交**: `82c400e`
|
||||
|
||||
---
|
||||
|
||||
## 下一步
|
||||
|
||||
1. **確認 OUTPUT_DIR 配置**
|
||||
- 檢查 Worker 使用的實際路徑
|
||||
- 確保與環境變量一致
|
||||
|
||||
2. **重啟 Worker**
|
||||
- 清理殘留狀態
|
||||
- 使用正確的環境變量
|
||||
|
||||
3. **完整測試**
|
||||
- 測試 Worker 能否正確運行處理器
|
||||
- 測試完整 Pipeline
|
||||
|
||||
---
|
||||
|
||||
## 相關文件
|
||||
|
||||
- `/Users/accusys/momentry_core/src/worker/job_worker.rs`
|
||||
- `/Users/accusys/momentry_core/src/core/config.rs`
|
||||
- `/Users/accusys/momentry_core/src/core/admin_config.rs`
|
||||
Reference in New Issue
Block a user