Progress bar support

The 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 particular applications.

class libertem.common.progress.ProgressReporter[source]

Interface for progress bar display / updating

This class will receive ProgressState instances 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 ProgressState message contains a field progress_id which is unique to each job, and therefore the implementation can use this to distinguish updates from multiple sources.

end(state: ProgressState)[source]

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)[source]

Signal the creation of a new job with the expected number of partitions and frames, and unique progress_id string.

update(state: ProgressState)[source]

Signal an intermediate update to the progress of a job

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)[source]

Container for progress state, used to communicate from ProgressManager to ProgressReporter

num_frames_complete: float

Number of frames processed

Type:

float

num_frames_total: int

Total number of frames to process

Type:

int

num_part_complete: int

Number of partitions completed

Type:

int

num_part_in_progress: int

Number of partitions in-progress

Type:

int

num_part_total: int

Total number of partitions

Type:

int

progress_id: str

A unique string identifier for the job associated with this progress message

Type:

str