Expand description
Conversion progress events (#783) — docling’s docling.datamodel.progress
(docling#4560, 2.139).
A ProgressCallback on the converter
(DocumentConverter::progress_callback)
receives every conversion’s events, one on a call
(convert_with_progress)
that call’s; show_progress
attaches the built-in ProgressPrinter, which is what the CLI’s
--progress prints. Events of one document arrive from the threads that
convert it — the page events of a parallel PDF walk from its workers — so
a callback must be Send + Sync and cheap; several documents converting
at once report concurrently, told apart by their document_index.
The sequence for one document is docling’s: ProgressKind::DocumentStarted,
then a ProgressKind::PageCompleted per page of a PDF / image / METS
conversion (completed_pages counts up to total_pages, the pages a
page_range selected; a page the document_timeout cut off is reported
with success: false, so the count still reaches the total), then a
ProgressKind::EnrichmentProgress per batch of the picture passes the
converter runs on the assembled document, and last
ProgressKind::DocumentCompleted with the result’s status — a failed
conversion ends with ConversionStatus::Failure. Declarative formats
(Office, HTML, …) have no pages to report: they emit the start and the
completion only. docling’s phase_started events are not ported: the
pipeline here has no separate build / assemble / enrich phases to time.
Structs§
- Progress
Event - One progress event: which document it is about and what happened.
- Progress
Printer - Ready-made
ProgressCallbackthat prints to stderr — docling’sProgressPrinter, whatDocumentConverter::show_progressand the CLI’s--progressattach. - Progress
Reporter - The per-document sink between a conversion and the callbacks —
docling’s
ProgressReporter. Every surface that drives the PDF pipeline itself (serve’s warm pipeline, the CLI batch, the bindings) makes one per document, handspage_hooktoPipeline::set_progress, and brackets the conversion withdocument_started/document_completed.
Enums§
- Enrichment
Step - Stable identifier of an enrichment pass, safe to match on — docling’s
EnrichmentStep. The passes the converter runs on the assembled document report here: picture description (the VLM pass, #670) and picture OCR (#645, a docling.rs extension whose text lands as the picture’s description); the per-page enrichments (code/formula, picture classification) run inside the page walk and are covered by its page events. - Progress
Kind - What a
ProgressEventreports.
Type Aliases§
- Progress
Callback - A progress callback: called with every event of the conversions it is attached to, from the thread that produced the event.