@@ -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 """
@@ -685,10 +699,5 @@ def update_cache(self):
685699 logger = get_structured_logger (
686700 __name__ , filename = _params ["common" ].get ("log_filename" ),
687701 log_exceptions = _params ["common" ].get ("log_exceptions" , True ))
688- start_time = time .time ()
689-
690- archiver_from_params (_params ).run ()
691702
692- elapsed_time_in_seconds = round (time .time () - start_time , 2 )
693- logger .info ("Completed archive run." ,
694- elapsed_time_in_seconds = elapsed_time_in_seconds )
703+ archiver_from_params (_params ).run (logger )
0 commit comments