Skip to content

Commit

Permalink
Merge pull request #121 from fedorov/check-disk-space
Browse files Browse the repository at this point in the history
ENH: do not start download if not enough space
  • Loading branch information
fedorov authored Sep 4, 2024
2 parents 3f37ebe + 46206d7 commit 51a436a
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 51a436a

Please sign in to comment.