diff --git a/transfer_service/retrieve_executor.py b/transfer_service/retrieve_executor.py index e4eba7d4b27296a59e685f2c99eca1cf1c0ba8b8..d86bb52558448107c40a958d0c9b32fe00cc6945 100644 --- a/transfer_service/retrieve_executor.py +++ b/transfer_service/retrieve_executor.py @@ -131,6 +131,8 @@ class RetrieveExecutor(TaskExecutor): md5calc = Checksum() if os.path.isdir(srcPath): for root, dirs, files in os.walk(srcPath, topdown = False): + dirSize = os.stat(root).st_size + self.totalSize += dirSize for f in files: fullPath = os.path.join(root, f) if md5calc.fileIsValid(fullPath): @@ -142,6 +144,7 @@ class RetrieveExecutor(TaskExecutor): "fileSize": fileSize, "vospaceRootParent": vospacePath } + self.totalSize += fileSize self.fileList.append(fileInfo.copy()) else: if md5calc.fileIsValid(srcPath): @@ -153,14 +156,15 @@ class RetrieveExecutor(TaskExecutor): "fileSize": fileSize, "vospaceRootParent": vospacePath } + self.totalSize += fileSize self.fileList.append(fileInfo.copy()) - - # debug block... - #if os.path.exists("fileList.txt"): - # os.remove("fileList.txt") - #fl = open("fileList.txt", 'w') - #fl.write(json.dumps(self.fileList, indent = 4)) - #fl.close() + self.logger.info(f"Total size of files to retrieve: {self.totalSize} B") + # debug block... + #if os.path.exists("fileList.txt"): + # os.remove("fileList.txt") + #fl = open("fileList.txt", 'w') + #fl.write(json.dumps(self.fileList, indent = 4)) + #fl.close() except Exception: self.logger.exception("FATAL: something went wrong while building the list of the files to be retrieved.") return False @@ -179,7 +183,7 @@ class RetrieveExecutor(TaskExecutor): blockSize = 0 for fileInfo in self.fileList: fileSize = fileInfo["fileSize"] - self.totalSize += fileSize + #self.totalSize += fileSize # check if the file is larger than a block size if fileSize > self.maxBlockSize: # if the current block is not empty, "close" it, otherwise