22import uuid
33import logging
44import hashlib
5+ from datetime import datetime
56from pathlib import Path
67from json import JSONDecodeError
78
@@ -25,6 +26,9 @@ def __init__(self, configuration_path, source_db, target_db, data_load_tracker_r
2526 self .all_model_pattern = self .model_pattern .format (model_name = '*' )
2627
2728 def start_imports (self , force_full_refresh_models ):
29+ self .logger .info (f"Starting Execution ID: '{ self .correlation_id } '" )
30+ execution_start_time = datetime .now ()
31+
2832 model_folder = Path (self .configuration_path )
2933 if not model_folder .is_dir ():
3034 raise NotADirectoryError (self .configuration_path )
@@ -57,6 +61,18 @@ def start_imports(self, force_full_refresh_models):
5761 self .start_single_import (model_file , request_full_refresh , model_number , total_number_of_models )
5862
5963 self .logger .info ("Execution completed." )
64+ execution_end_time = datetime .now ()
65+ total_execution_seconds = int ((execution_end_time - execution_start_time ).total_seconds ())
66+ execution_hours = total_execution_seconds // 3600
67+ execution_minutes = (total_execution_seconds // 60 ) % 60
68+ execution_seconds = total_execution_seconds % 60
69+ total_number_of_rows_processed = self .data_load_tracker_repository .get_execution_rows (self .correlation_id )
70+ self .logger .info (
71+ f"Completed Execution ID: { self .correlation_id } "
72+ f"\n \t Models Processed: { total_number_of_models } "
73+ f"\n \t Rows Processed: { total_number_of_rows_processed } "
74+ f"\n \t Execution Time: { execution_hours } h { execution_minutes } m { execution_seconds } s"
75+ f"\n \t Average of { total_number_of_rows_processed // max (total_execution_seconds , 1 )} rows per second." )
6076
6177 def start_single_import (self , model_file , requested_full_refresh , model_number , total_number_of_models ):
6278 model_name = model_file .stem
0 commit comments