Skip to content

Commit

Permalink
Refresh the progress bars on exit
Browse files Browse the repository at this point in the history
Because we don't update the progress bars on every iteration, it is
possible that we finish without the bars reaching 100%, specially in
very small files. The progress bars normally dissapear so this is not
much of a problem, but in Jypiter notebooks the output may linger,
making it a bit confusing.

To avoid this problem, emit a last refresh on exit that updates the
status of the progress bars to 100%.

Signed-off-by: Pablo Galindo <[email protected]>
  • Loading branch information
pablogsal committed Nov 7, 2023
1 parent aa3470a commit 2defa44
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/memray/_memray.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,7 @@ cdef class ProgressIndicator:
def __exit__(self, type, value, traceback):
if not self._report_progress:
return
self._context_manager.update(self._task, completed=self._cumulative_num_processed)
return self._context_manager.__exit__(type, value, traceback)

cdef bool _time_for_refresh(self):
Expand Down

0 comments on commit 2defa44

Please sign in to comment.