Skip to content

Commit 51a436a

Browse files
authored
Merge pull request #121 from fedorov/check-disk-space
ENH: do not start download if not enough space
2 parents 3f37ebe + 46206d7 commit 51a436a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

idc_index/index.py

+11
Original file line numberDiff line numberDiff line change
@@ -1531,6 +1531,17 @@ def download_from_selection(
15311531
)
15321532

15331533
total_size = round(result_df["series_size_MB"].sum(), 2)
1534+
disk_free_space_MB = psutil.disk_usage(downloadDir).free / (1000 * 1000)
1535+
if disk_free_space_MB < total_size:
1536+
logger.error("Not enough free space on disk to download the files.")
1537+
logger.error(
1538+
"Total size of files to download: " + self._format_size(total_size)
1539+
)
1540+
logger.error(
1541+
"Total free space on disk: " + self._format_size(disk_free_space_MB)
1542+
)
1543+
return
1544+
15341545
logger.info("Total size of files to download: " + self._format_size(total_size))
15351546
logger.info(
15361547
"Total free space on disk: "

0 commit comments

Comments
 (0)