Skip to content

Commit 16a0b26

Browse files
committed
Do more robust handling of download failures.
1 parent 5e8378b commit 16a0b26

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

ricecooker/utils/pipeline/file_handler.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,12 @@ def execute(
252252

253253
file_metadata.path = path
254254

255+
# Ensure the file was actually processed and is in storage
256+
if not path.startswith(os.path.abspath(config.STORAGE_DIRECTORY)):
257+
raise InvalidFileException(
258+
f"File handler failed to process {original_path} - result not in storage"
259+
)
260+
255261
self._output_path = None
256262

257263
file_metadata_list.append(file_metadata)

ricecooker/utils/pipeline/transfer.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,4 @@ def execute(
434434
# The download stage is special, as we expect it to always return a file
435435
# if it does not, we raise an exception to prevent further processing
436436
raise InvalidFileException(f"No file could be downloaded from {path}")
437-
for metadata in metadata_list:
438-
if metadata.path == path:
439-
raise InvalidFileException(f"{path} failed to transfer")
440437
return metadata_list

0 commit comments

Comments
 (0)