@@ -307,8 +307,9 @@ def filter_exports(self, common_diffs: FileDiffMap):
307307 else :
308308 replace (diff_file , exported_file )
309309
310- def run (self ):
310+ def run (self , logger = None ):
311311 """Run the differ and archive the changed and new files."""
312+ start_time = time .time ()
312313 self .update_cache ()
313314
314315 # Diff exports, and make incremental versions
@@ -317,6 +318,11 @@ def run(self):
317318 # Archive changed and new files only
318319 to_archive = [f for f , diff in common_diffs .items ()
319320 if diff is not None ]
321+ if logger :
322+ logger .debug ("Diffed exports" ,
323+ phase = "archiving"
324+ new_files_count = len (new_files ),
325+ common_diffs_count = len (to_archive ))
320326 to_archive += new_files
321327 _ , fails = self .archive_exports (to_archive )
322328
@@ -329,6 +335,14 @@ def run(self):
329335 for exported_file in fails :
330336 print (f"Failed to archive '{ exported_file } '" )
331337
338+ elapsed_time_in_seconds = round (time .time () - start_time , 2 )
339+ if logger :
340+ logger .info ("Completed archive run" ,
341+ phase = "archiving" ,
342+ elapsed_time_in_seconds = elapsed_time_in_seconds ,
343+ new_changed_count = len (to_archive ),
344+ fail_count = len (fails ))
345+
332346
333347class S3ArchiveDiffer (ArchiveDiffer ):
334348 """
@@ -686,10 +700,5 @@ def update_cache(self):
686700 logger = get_structured_logger (
687701 __name__ , filename = _params ["common" ].get ("log_filename" ),
688702 log_exceptions = _params ["common" ].get ("log_exceptions" , True ))
689- start_time = time .time ()
690-
691- archiver_from_params (_params ).run ()
692703
693- elapsed_time_in_seconds = round (time .time () - start_time , 2 )
694- logger .info ("Completed archive run." ,
695- elapsed_time_in_seconds = elapsed_time_in_seconds )
704+ archiver_from_params (_params ).run (logger )
0 commit comments