quantlab.utils.progress#
Progress events and cooperative cancellation for long-running loops.
Two loops in quantlab can run for hours: the acquisition engine, which
downloads data from a vendor in batches, and the conversion loop, which turns
raw vendor files into a Zarr store one time window at a time. Both report
progress by handing ProgressEvent objects to a ProgressReporter.
Three reporters are provided. TqdmProgressReporter draws a progress bar
on stderr and is the default. NullProgressReporter discards everything.
CallbackProgressReporter forwards each event to a function you supply, so
an in-process user interface can follow a run without parsing terminal
output. CancelToken is the matching stop signal: the caller sets it, and
the loop stops at its next safe point.
This module imports only the standard library and tqdm, so any part of
quantlab can import it without creating an import cycle. Reporters’ exceptions
are not caught here. The loop that calls emit catches them and removes
credentials from the message before logging it, because only that loop knows
which credentials are in play.
Classes
Reporter that forwards every event to a function you supply. |
|
Cooperative stop signal that a long loop checks between steps. |
|
Reporter that discards every event. |
|
One thing that happened during an acquisition or a conversion. |
|
Abstract destination for progress events. |
|
Default reporter: a |