diff --git a/pymods/irods_utils/irods_utils.py b/pymods/irods_utils/irods_utils.py index bf11b0555bcb059f6703fd13a76a37bb56c4b274..e8bc55c7c3d354b0c182e76938baf114c87212fb 100644 --- a/pymods/irods_utils/irods_utils.py +++ b/pymods/irods_utils/irods_utils.py @@ -361,22 +361,30 @@ def confirmed_put( irods_sesh, file, new_obj_ipath, metadata_dict=None, datatype + " ipath: " + new_obj_ipath ) return new_obj # will not upload since the object and metadata should now match. - # Expect to be able to put now. - # The file is new and will be uploaded here along with metadata. - new_obj_ipath_tmp = new_obj_ipath + "_tmp" - - # Check if the temp obj exists - try: - options = {} # shouldn't care about the checksum {kw.VERIFY_CHKSUM_KW: ''} - new_obj = irods_sesh.data_objects.get( new_obj_ipath_tmp, **options ) - irods_sesh.data_objects.unlink( new_obj_ipath_tmp, force = True ) - logging.error( "new_obj tmp file existed and has been deleted. This means we've tried to upload here before and failed." - + " new_obj_ipath_tmp " + new_obj_ipath_tmp ) - except Exception as ex: - logging.debug( "Failed to get new_obj_ipath_tmp. (OK because we expect to create it.)" - + " tmp ipath: " + new_obj_ipath_tmp - + " ex: " + str(ex) ) + # !! This code had a problem with a network error leaving table row for object + # !! with data_is_dirty set wrong. Table r_data_main + ## Expect to be able to put now. + ## The file is new and will be uploaded here along with metadata. + #new_obj_ipath_tmp = new_obj_ipath + "_tmp" + # + ## Check if the temp obj exists + #try: + # options = {} # shouldn't care about the checksum {kw.VERIFY_CHKSUM_KW: ''} + # new_obj = irods_sesh.data_objects.get( new_obj_ipath_tmp, **options ) + # # When there has not been an exception, delete the old tmp object + # irods_sesh.data_objects.unlink( new_obj_ipath_tmp, force = True ) + # logging.error( "new_obj tmp file existed and has been deleted. This means we've tried to upload here before and failed." + # + " new_obj_ipath_tmp " + new_obj_ipath_tmp ) + #except Exception as ex: + # logging.debug( "Failed to get new_obj_ipath_tmp. (OK because we expect to create it.)" + # + " tmp ipath: " + new_obj_ipath_tmp + # + " ex: " + str(ex) ) + # + # Make a timestamped partial tmp file name which, if the upload somehow fails here, will be left behind + # Hopefully this does not happen much, but we have seen at least on case so far. + # Cleanup will need to be done elsewhere. + new_obj_ipath_tmp = new_obj_ipath + ".part." + datetime.datetime.now().strftime("%Y-%m-%d_%H:%M:%S.%fZ%z") logging.debug("Uploading file: " + file + " to tmp ipath: " + new_obj_ipath_tmp ) try: