datasalad.progress
Handling progress reports from custom operations implementations
This is tooling that (for example) simple functions can use to report on the progress of one or more (simultaneous) tasks.
The idea is that any such function accepts a progress handler as a parameter. For example:
>>> def fx(args, progress_handler: ProgressHandler | None = None):
... pass
whenever it is given a handler, it can use the API define in the
ProgressHandler base class to register tasks,
update on their progress, and also remove them again (leaving informative
messages at all steps).
A caller can provide a progress handler implementation that is suitable in the context a function is called (think: a GUI application vs a script vs a CLI tool).
Function can make a progress handler parameter optional. This can be used to communicate to the function that progress reports need not be made, and based on this knowledge different/simpler code paths could be used.
Abstract base class of progress handlers |
|
Progress handler that does not report progress |
|
Handler that reports progress to a file-like (incl. |