docling icon indicating copy to clipboard operation
docling copied to clipboard

Progress report

Open dolfim-ibm opened this issue 11 months ago • 3 comments

Requested feature

We would like to allow (as an option) some sort of event progress report, i.e. some update after each page or page batch.

  • In the CLI this could produce a progress bar or simply some messages.
  • When using Docling as a library we can allow the registration of event handlers which are called. In applications like docling-serve, this could provide updates via a websocket to the end user.

dolfim-ibm avatar Dec 08 '25 07:12 dolfim-ibm

I would like this as well. I am building an app that uses docling-serve to process documents as part of the user workflow. It would greatly enhance my UX if I had the ability to provide a meaningful progress status in the UI. It would make sense to add a progress field in the async status poll response. Page-by-page progress seems like the way to go, though admittedly I don't know if there is additional processing in Docling that makes it a bit more complicated to estimate progress. With that said, even a rough estimate would be very useful.

jwzaden avatar Feb 10 '26 20:02 jwzaden

Hi Dr @dolfim-ibm, thank you for opening this, and I hope it's alright to bring it up again.

Issue #4547 was opened yesterday asking for the same thing, so it seems there is still a lot of interest. I saw that #3042 by @mrowdy implements it, Its last commit was on May 6 and the conflicts are still open, so I think the author may not have time to continue it at the moment. #3566 by @assinscreedFC is a smaller page-only version.

While testing both against current main I noticed a few things a progress bar still seems to need. I may be missing something, so please correct me:

  • The bar sits at 100% after the last page. Picture classification, picture description, chart extraction and code/formula enrichment run on the whole document after all pages are done, and neither PR reports progress inside that step. With picture description enabled this can be the longest part of the conversion.
  • In #3042, pages cut by document_timeout or lost when the pipeline stops early are never reported, and failed pages look the same as successful ones, so the page count can stop short of the total. #3566 handles this for the threaded PDF pipeline.
  • The VLM, native and threaded layout+VLM pipelines on current main have their own page loops, so neither PR's hooks reach them.
  • Folders and batches: inputs that are skipped or invalid get no events, and there is nothing that tells two files with the same name apart.

I've prepared a version on top of current main that keeps the ideas of both PRs (the phase events and --progress flag from #3042, the per-call plumbing and terminal page events from #3566) and adds those parts:

  • EnrichmentProgress with completed_items / total_items for each enrichment step, so the bar keeps moving after the pages
  • PageCompletedProgress from every page-based pipeline, exactly once per page (failed and timed-out pages with success=False), with an order-independent completed_pages counter that follows page_range
  • DocumentStarted / DocumentCompleted for every input, including skipped ones, with a document_index so a folder can be shown as "3 of 12"
  • an initialize phase, since the first document can wait a long time while models download
  • no signature change to _build_document, so custom pipelines keep working, and callback exceptions never break a conversion
  • docling convert --progress, docs and tests

Would it be helpful if I opened it as a PR, with credit to both authors? If you would prefer to continue with #3042 instead, I'd also be very happy to send these as suggestions there. Thank you very much for your time!

DanielNg0729 avatar Oct 04 '26 09:10 DanielNg0729

Three open PRs implement progress reporting for this issue: #3042, #3566 and #4560. Here is how they compare. The plan is to continue with #4560 and close the other two as superseded once it is merged.

#3042 #3566 #4560
State Merges cleanly; the last push (2026-10-05) is a merge of main, no new features Merge conflicts, no commits since June Updated after review
Events identify the document document_name only No document identity document_name + document_index
Callback scope Per converter Per converter Per converter and per convert / convert_all call
Typed JSON round-trip No (event_type is a plain field) kind literals, union not annotated Discriminated union on kind
Failed and timed-out pages Not reported PDF pipeline only All page pipelines
Correct count with out-of-order pages No No Yes (completed_pages)
Enrichment progress No No Yes, per step, with a stable EnrichmentStep
Skipped or invalid inputs No events No events Started and completed events
A raising callback cannot break conversion Partly (DOCUMENT_START is unguarded) Yes Yes
Existing _build_document(self, conv_res) overrides Kept via inspect.signature probing Broken (callback passed positionally) Kept, signature unchanged
CLI --progress, plain print to stdout None tqdm bars on stderr, log lines kept above the bars

The per-call callback and the document identity matter for docling-serve: converters are cached and shared between requests, so events must be routable to the task that started them.

What is still worth carrying over:

  • Page count at document start (#3042). #3042 sends page_count with DOCUMENT_START. In #4560 the total arrives only with the first PageCompletedProgress, so a UI cannot size its bar while models load. An optional total_pages on DocumentStartedProgress (same page_range semantics) would cover it. Not a blocker, can be a follow-up.
  • Phase completed events (#3042): not needed, the next phase start or DocumentCompleted marks the end.
  • Page started events (#3566): not needed. In the threaded PDF pipeline pages start on a feeder thread, which would break the guarantee that all events come from the calling thread, and they add little for a progress bar.

Thanks @mrowdy and @assinscreedFC for the earlier work: #4560 builds on the phase events and --progress flag of #3042 and on the call plumbing and failed-page events of #3566.

@cau-git fyi

dolfim-ibm avatar Oct 08 '26 09:10 dolfim-ibm