Skip to content

Commit

Permalink
ENH: do not start download if not enough space
Browse files Browse the repository at this point in the history
  • Loading branch information
fedorov committed Sep 4, 2024
1 parent 3f37ebe commit 46206d7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions idc_index/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -1531,6 +1531,17 @@ def download_from_selection(
)

total_size = round(result_df["series_size_MB"].sum(), 2)
disk_free_space_MB = psutil.disk_usage(downloadDir).free / (1000 * 1000)
if disk_free_space_MB < total_size:
logger.error("Not enough free space on disk to download the files.")
logger.error(
"Total size of files to download: " + self._format_size(total_size)
)
logger.error(
"Total free space on disk: " + self._format_size(disk_free_space_MB)
)
return

logger.info("Total size of files to download: " + self._format_size(total_size))
logger.info(
"Total free space on disk: "
Expand Down

0 comments on commit 46206d7

Please sign in to comment.