From f8b3dbf9ec864bce177e25b0ba563b5690ab1ccd Mon Sep 17 00:00:00 2001 From: Blake Fitch <blake.fitch@tuebingen.mpg.de> Date: Mon, 15 Apr 2024 11:19:04 +0200 Subject: [PATCH] reduce log lines on object mismatch to one --- pymods/irods_utils/irods_utils.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pymods/irods_utils/irods_utils.py b/pymods/irods_utils/irods_utils.py index 1a537d7..cbbb295 100644 --- a/pymods/irods_utils/irods_utils.py +++ b/pymods/irods_utils/irods_utils.py @@ -445,18 +445,20 @@ def confirmed_put( irods_sesh, file_pathname, new_obj_ipath, metadata_dict=None, if existing_obj.checksum != new_obj_hash_256 : mismatch = True - logging.error( "Object prexists but data mismatches." + mismatch_reason = "data csm" + logging.debug( "Object prexists but data mismatches." + " file_pathname " + file_pathname ) else: # Get the existing objects metadata as a python dict existing_obj_dict = irods_avus_to_pydict( existing_obj ) if existing_obj_dict != metadata_dict: - logging.error( "Object matches on data but mismatches metadata." + logging.debug( "Object matches on data but mismatches metadata." + " new avu dict: " + str( metadata_dict ) + " existing dict: " + str( existing_obj_dict ) + " file_pathname: " + file_pathname ) mismatch = True + mismatch_reason = "metadata" if mismatch: # Mismatch existing object. Move the old object out of the way and date it. @@ -468,7 +470,7 @@ def confirmed_put( irods_sesh, file_pathname, new_obj_ipath, metadata_dict=None, + " path " + existing_obj.path + " ex: " + str( ex ) ) return None - logging.warn( "Moved mismatching existing object to ipath: " + dup_ipath ) + logging.warn( f"Moved mismatching existing object (reason: {mismatch_reason}) to ipath: {dup_ipath}" ) # Fall through to move newly uploaded object into place. else: # Matching existing object. Remove the tmp object we just uploaded and leave the old one. -- GitLab