def after_batch(self, stream_name: str, batch_data: Batch) -> None:
        """
        Display the progress and ETA for the current stream in the epoch.
        If the stream size (total batch count) is unknown (1st epoch), print only the number of processed batches.
        """
        if self._current_stream_name is None or self._current_stream_name != stream_name:
            self._current_stream_name = stream_name
            self._current_stream_start = None
        erase_line()

        self._current_batch_count[stream_name] += 1
        current_batch = self._current_batch_count[stream_name]

        # total batch count is available
        if stream_name in self._total_batch_count:
            # compute ETA
            total_batches = self._total_batch_count[stream_name]
            if self._current_stream_start:
                measured_batches = current_batch - 1
                avg_batch_time = (time.time() - self._current_stream_start) / measured_batches
                eta_sec = avg_batch_time * (total_batches - current_batch)
                eta = get_formatted_time(eta_sec)
            else:
                self._current_stream_start = time.time()
                eta = ''

            print_progress_bar(current_batch, total_batches, prefix=stream_name, suffix=eta)

        # total batch count is not available (1st epoch)
        else:
            short_progress = '{}: {}'.format(stream_name, current_batch)
            if len(short_progress) <= shutil.get_terminal_size().columns:
                print(short_progress, end='\r')
            else:
                print(['-', '\\', '|', '/'][current_batch % 4],  end='\r')
def after_batch ( self , stream_name : str , batch_data : Batch ) -> None : if self . _current_stream_name is None or self . _current_stream_name != stream_name : self . _current_stream_name = stream_name self . _current_stream_start = None erase_line ( ) self . _current_batch_count [ stream_name ] += 1 current_batch = self . _current_batch_count [ stream_name ] if stream_name in self . _total_batch_count : total_batches = self . _total_batch_count [ stream_name ] if self . _current_stream_start : measured_batches = current_batch - 1 avg_batch_time = ( time . time ( ) - self . _current_stream_start ) / measured_batches eta_sec = avg_batch_time * ( total_batches - current_batch ) eta = get_formatted_time ( eta_sec ) else : self . _current_stream_start = time . time ( ) eta = '' print_progress_bar ( current_batch , total_batches , prefix = stream_name , suffix = eta ) else : short_progress = '{}: {}' . format ( stream_name , current_batch ) if len ( short_progress ) <= shutil . get_terminal_size ( ) . columns : print ( short_progress , end = '\r' ) else : print ( [ '-' , '\\' , '|' , '/' ] [ current_batch % 4 ] , end = '\r' )
Display the progress and ETA for the current stream in the epoch.
        If the stream size (total batch count) is unknown (1st epoch), print only the number of processed batches.