Progress bar support¶
ProgressReporter is used to display the progress
bar during calls to
libertem.api.Context. In normal
usage there is no need to instantiate these classes directly,
but they can be used to modify how progress is displayed in
- class libertem.common.progress.ProgressReporter¶
Interface for progress bar display / updating
This class will receive
ProgressStateinstances to notify it about the start, progression and end of a job submitted to the
UDFRunner. The implementation should be adapted to display or log the progress as required for the use case.
It is possible that multiple jobs are submitted to a single executor at the same time and therefore the implementation should ensure that concurrent instances of the class display correctly, or that the same instance of the class can handle updates from multiple threads concurrently. Each
ProgressStatemessage contains a field
progress_idwhich is unique to each job, and therefore the implementation can use this to distinguish updates from multiple sources.
- end(state: ProgressState)¶
Signal the end of a given job
This method will always be called and any updates recieved after this message should be ignored.
- start(state: ProgressState)¶
Signal the creation of a new job with the expected number of partitions and frames, and unique progress_id string.
- class libertem.common.progress.ProgressState(num_frames_complete: float, num_frames_total: int, num_part_complete: int, num_part_in_progress: int, num_part_total: int, progress_id: str)¶
Container for progress state, used to communicate from ProgressManager to ProgressReporter