Skip to content

Commit

Permalink
Fix minor bugs in new hfs upload handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Harshg999 committed Nov 13, 2024
1 parent c73af1f commit 1ffe9bf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion desktop/libs/hadoop/src/hadoop/fs/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ def __del__(self):
if self._do_cleanup:
# Do not do cleanup here. It's hopeless. The self._fs threadlocal states
# are going to be all wrong.

# TODO: Check if this is required with new upload handler flow
LOG.debug(f"Check for left-over upload file for cleanup if the upload op was unsuccessful: {self._path}")

def get_temp_path(self):
Expand Down Expand Up @@ -378,6 +380,7 @@ def new_file(self, field_name, file_name, *args, **kwargs):
self._starttime = time.time()
except Exception as ex:
LOG.error("Not using HDFS upload handler: %s" % (ex))
raise ex

raise StopFutureHandlers()

Expand Down Expand Up @@ -405,7 +408,7 @@ def file_complete(self, file_size):

def upload_complete(self):
LOG.debug("HDFSFileUploadHandler: Running after upload complete task")
original_file_path = self.join(self._destination, self._file.name)
original_file_path = self._fs.join(self._destination, self._file.name)
tmp_file = self._file.get_temp_path()

self._fs.do_as_user(self.username, self._fs.rename, tmp_file, original_file_path)
Expand Down

0 comments on commit 1ffe9bf

Please sign in to comment.