Skip to content
Snippets Groups Projects
Commit c1d39e02 authored by Alan De Smet's avatar Alan De Smet
Browse files

Treat 0-length downloaded files as failure

Attempted workaround for https://gitlab.ssec.wisc.edu/cspp_geo/cspp-geo-aitf/-/issues/479
parent 94960751
No related branches found
No related tags found
No related merge requests found
...@@ -630,6 +630,16 @@ def download_all(url_to_dst, download_stats, do_download, timeout): ...@@ -630,6 +630,16 @@ def download_all(url_to_dst, download_stats, do_download, timeout):
logging.debug(f" {dst} removed") logging.debug(f" {dst} removed")
raise raise
# Attempted workaround for mysterious 0-length files
for url,dst in todo.items():
(path,file,atomic) = dst
size = os.path.getsize(path)
logging.debug(f"{path} is {size} bytes long");
if size == 0:
logging.warning(f"Downloaded file {path} is empty; it shouldn't be. Deleting it to prevent cascading failures. Other jobs running now may have problems.")
os.unlink(path)
raise Exception(f"Unexpected empty file: {path}")
class CleaningStats: class CleaningStats:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment