@@ -28,7 +28,11 @@ def console(self) -> 'Console':
2828 return self .env .rich_error_console
2929
3030 def _print_summary (
31- self , is_finished : bool , observed_steps : int , time_spent : float
31+ self ,
32+ is_finished : bool ,
33+ observed_steps : float ,
34+ time_spent : float ,
35+ total_steps : Optional [float ] = None ,
3236 ):
3337 from rich import filesize
3438
@@ -37,7 +41,10 @@ def _print_summary(
3741 else :
3842 verb = 'Interrupted'
3943
40- total_size = filesize .decimal (observed_steps )
44+ if total_steps is None :
45+ total_steps = observed_steps
46+
47+ total_size = filesize .decimal (total_steps )
4148 avg_speed = filesize .decimal (observed_steps / time_spent )
4249
4350 minutes , seconds = divmod (time_spent , 60 )
@@ -63,6 +70,7 @@ class StatusDisplay(BaseDisplay):
6370 def start (
6471 self , * , total : Optional [float ], at : float , description : str
6572 ) -> None :
73+ self .initial_observed = at
6674 self .observed = at
6775 self .description = (
6876 f'[progress.description]{ description } [/progress.description]'
@@ -89,8 +97,9 @@ def stop(self, time_spent: float) -> None:
8997 if time_spent :
9098 self ._print_summary (
9199 is_finished = True ,
92- observed_steps = self .observed ,
100+ observed_steps = self .observed - self . initial_observed ,
93101 time_spent = time_spent ,
102+ total_steps = self .observed ,
94103 )
95104
96105
@@ -107,6 +116,7 @@ def start(
107116 )
108117
109118 assert total is not None
119+ self .initial_completed = at
110120 self .console .print (f'[progress.description]{ description } ' )
111121 self .progress_bar = Progress (
112122 '[' ,
@@ -136,6 +146,7 @@ def stop(self, time_spent: Optional[float]) -> None:
136146 [task ] = self .progress_bar .tasks
137147 self ._print_summary (
138148 is_finished = task .finished ,
139- observed_steps = task .completed ,
149+ observed_steps = task .completed - self . initial_completed ,
140150 time_spent = time_spent ,
151+ total_steps = task .completed ,
141152 )
0 commit comments