quantlab.utils.progress.TqdmProgressReporter#
- class quantlab.utils.progress.TqdmProgressReporter(*, disable=False)[source]#
Bases:
ProgressReporterDefault reporter: a
tqdmprogress bar on stderr.The bar is created on
run_started, the first event that knows the number of batches, with the event’smessageas its label. Eachbatch_completedadvances it by one. The firstquota_exhaustedin a run changes the label to the event’s message (orQUOTA_EXHAUSTED_DESCRIPTION); repeats are ignored because the label describes a state that has already been shown.run_finishedcloses the bar. A newrun_startedcloses any open bar and starts a fresh one, so a retry loop that makes several passes shows one bar per pass.This reporter only reacts to acquisition events; conversion events are ignored.
- Parameters:
- disablebool, default False
Passed to
tqdm. When true, nothing is drawn.
Examples
>>> reporter = TqdmProgressReporter() >>> acquisition.attach(reporter=reporter).download()
- close()[source]#
Close the open bar, if any.
Examples
>>> reporter = TqdmProgressReporter(disable=True) >>> reporter.close() # a no-op while no bar is open
- emit(event)[source]#
Open, advance, relabel or close the bar according to
event.- Parameters:
- eventProgressEvent
The event to render. Kinds other than
run_started,batch_completed,quota_exhaustedandrun_finishedare ignored.
Examples
>>> reporter = TqdmProgressReporter(disable=True) >>> reporter.emit(ProgressEvent(kind="run_started", vendor="tiingo", ... total=2, message="tiingo 1d")) >>> reporter.emit(ProgressEvent(kind="batch_completed", ... vendor="tiingo", completed=1, total=2)) >>> reporter.emit(ProgressEvent(kind="run_finished", vendor="tiingo", ... completed=2, total=2))