Expand description
Progress reporting.
A push model: a worker that has just
finished some work calls ProgressTracker::add, and that is where the
callback fires — when the fraction done has advanced by at least
REPORT_INTERVAL since the last report.
§Why the callback runs on the worker
Because it can. In the Python build the callback is a Python object and the workers are rayon threads, but the thread that owns the request has released the GIL for the whole extraction, so a worker is free to take it. The alternative — accumulating silently and having the owning thread poll — reports nothing at all while a single long window is being read, which is exactly when a caller wants to see progress.
The report lock is held across the callback. That is deliberate: every thread takes this lock before the GIL and never the other way round, so there is one acquisition order and no cycle to deadlock on.
Structs§
- Cancel
Flag - A flag a caller sets to stop a long operation between two of its steps.
- Progress
Tracker
Constants§
- REPORT_
INTERVAL - Minimum fractional progress between two callbacks.
Functions§
- default_
progress - The terminal bar installed when
progress=True.
Type Aliases§
- Progress
Fn - Called with (done, total), both in base pairs.