Files
momentry_core/config/README_pipeline.md
T
Accusys 882e31ab96 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
2026-10-15 13:01:12 +08:00

173 lines
4.0 KiB
Markdown

# Pipeline Configuration
**File**: `config/pipeline_flows.json`
---
## 📋 Purpose
This configuration file defines the processing pipeline for video analysis tasks. It controls:
- Which processors run and in what order
- Tool selection and parameters
- Execution conditions and dependencies
- Failure handling and timeouts
---
## 🚀 Quick Start
### View Current Configuration
```bash
# View pipeline configuration
cat config/pipeline_flows.json | jq
# Check specific flow
jq '.flows.register' config/pipeline_flows.json
```
### Modify Configuration
1. Edit `config/pipeline_flows.json`
2. Validate JSON syntax: `jq . config/pipeline_flows.json`
3. Restart worker: `launchctl restart gui/$(id -u)/com.momentry.worker`
---
## 📊 Configuration Structure
```
pipeline_flows.json
├── version # Schema version
├── enabled # Global enable/disable
├── max_concurrent_stages # Concurrency limit
├── default_timeout_secs # Default timeout
└── flows # Pipeline definitions
├── register # Full registration pipeline
├── reprocess # Selective reprocessing
└── phase1_pack # Packaging pipeline
```
---
## 🔄 Available Flows
### register
**Purpose**: Complete video processing pipeline
**Stages**: cut → asr → face → ocr → scene → asrx
**Usage**: Automatically triggered during video registration
---
### reprocess
**Purpose**: Selective reprocessing of specific processors
**Usage**: Manually triggered via Admin Panel or API
---
### phase1_pack
**Purpose**: Package Phase 1 results
**Usage**: Triggered after register completes
---
## 🔀 Execution Mode: Parallel vs Blocking
Each stage's `parallel` flag is the **single source of truth** for how the worker
executes that stage. The worker reads it at runtime (via
`src/core/pipeline_config.rs`) instead of hardcoding the mode per processor.
| `parallel` | Meaning | Worker behavior |
|------------|---------|-----------------|
| `true` | Non-blocking | Stage is dispatched to the background (pool or `tokio::spawn`); the worker poll loop continues. |
| `false` | Blocking | Stage runs inline; the caller waits for it to finish before continuing. |
Unknown / missing stages default to `true` (parallel), so a missing entry never
reintroduces blocking.
**Scene VLM example**: the `scene` stage is declared `"parallel": true`, so Scene
VLM (which can run for hours on a large file) is spawned as a background task
instead of being awaited inline. A semaphore (1 concurrent) and an in-flight set
guard against duplicate spawns across poll cycles. Setting `"parallel": false`
would restore the previous inline/blocking behavior.
---
## 🛠️ Tool Selection
### Priority System
- **0**: Highest priority (preferred tool)
- **1-99**: Fallback tools
### Example
```json
{
"tools": [
{
"name": "swift_face",
"priority": 0,
"description": "ANE accelerated"
},
{
"name": "python_insightface",
"priority": 1,
"description": "CPU fallback"
}
]
}
```
---
## 📚 Documentation
- **Full Guide**: `docs_v1.0/OPERATIONS/Pipeline_Configuration_Guide.md`
- **Processor Reference**: `docs_v1.0/OPERATIONS/Processor_Commands_Reference.md`
- **Tool Selector**: `docs_v1.0/DESIGN/Tool_Selector_V1.0.md`
---
## 🔍 Debugging
### Check Pipeline Status
```bash
# View worker logs
tail -f logs/worker_3002.log | grep -E "Pipeline|Stage"
# Check processor jobs
psql -U accusys -d momentry -c "SELECT uuid, processor_type, status FROM processor_jobs ORDER BY created_at DESC LIMIT 10;"
```
### Test Configuration
```bash
# Validate JSON
jq . config/pipeline_flows.json
# Check specific processor
jq '.flows.register.stages[] | select(.name == "face")' config/pipeline_flows.json
```
---
## ⚠️ Important
1. **Always validate JSON** before saving
2. **Restart worker** after configuration changes
3. **Backup configuration** before major changes
4. **Test changes** in development environment first
---
**Last Updated**: 2026-10-14