diff --git a/grobid_client/grobid_client.py b/grobid_client/grobid_client.py index 6524cd7..c4d4d98 100644 --- a/grobid_client/grobid_client.py +++ b/grobid_client/grobid_client.py @@ -424,6 +424,7 @@ def process_batch( verbose=False, flavor=None ): + batch_start_time = time.time() if verbose: self.logger.info(f"{len(input_files)} files to process in current batch") @@ -494,6 +495,14 @@ def process_batch( except OSError as e: self.logger.error(f"Failed to write TEI XML file {filename}: {str(e)}") + # Calculate batch statistics + batch_runtime = time.time() - batch_start_time + batch_docs_per_second = processed_count / batch_runtime if batch_runtime > 0 else 0 + + if verbose: + self.logger.info(f"⏱️ Runtime: {batch_runtime:.2f} seconds") + self.logger.info(f"🚀 Speed: {batch_docs_per_second:.2f} documents/second") + return processed_count def process_pdf(