Structured progress reporting for pipelines.
Source: screencastgen/pipelines/events.py
PipelineReporter bridges human-readable console output and machine-parseable structured events. Pipelines call reporter methods at each phase; consumers (CLI stdout, web progress bridge) receive the output.
PipelineEvent| Field | Type | Description |
|---|---|---|
status |
str |
Current status (e.g., "running", "completed") |
phase |
str |
Current phase name |
current |
int |
Progress numerator |
total |
int |
Progress denominator |
message |
str |
Human-readable description |
data |
dict \| None |
Optional structured payload for richer UI updates, such as lip-sync page timing |
PipelineReporterPipelineReporter(stream=sys.stdout, on_event=None, should_cancel=None)
on_event is a callback (PipelineEvent) -> None for structured event consumers. should_cancel is an optional callback used by long-running hosts such as the web worker.
| Method | Description |
|---|---|
cancelled() |
Returns whether the host requested early cancellation |
line(message) |
Write a human-readable line to the stream |
emit(phase, current, total, message, status="running", data=None) |
Publish a structured event and update internal state |
phase_start(phase, message) |
Announce a phase transition |
Pipeline Runner
│
├── reporter.phase_start("extraction", "Extracting text...")
├── reporter.emit("synthesis", 1, 10, "Chunk 1/10")
├── reporter.emit("synthesis", 2, 10, "Chunk 2/10")
│ ...
└── reporter.emit("complete", 10, 10, "Done", status="completed")
│
▼
┌────────────────┐ ┌──────────────────────┐
│ CLI stdout │ │ Progress Reporter │
│ (human text) │ │ (DB + Redis pubsub) │
└────────────────┘ └──────────────────────┘
Pipeline Events
└──▶ consumed by Audio Pipeline
├──▶ Highlight Pipeline
├──▶ Lipsync Pipeline
├──▶ Pipeline Common
└──▶ Progress Reporter (web app)