-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathharvest_disk.py
24 lines (20 loc) · 1.04 KB
/
harvest_disk.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import config_loader
import log_utils as wp
from utils import get_disk_info, print_disk_info, can_plot_at_least_one_plot_safely
def harvest_all_disk() -> dict:
free_disk_space = {}
for disk in config_loader.Config.directories_to_plot:
print_disk_info(disk)
_, _, free_disk_space[disk] = get_disk_info(disk)
return free_disk_space
def calculate_plot(disks_info: dict) -> str:
for disk_name, disk_info in disks_info.items():
while disk_info > config_loader.chia_const[config_loader.Config.compression_level]['gib'] * 2:
wp.Logger.bladebit_plotter_logger.log(wp.Logger.SUCCESS, 'going to plot on {}'.format(disk_name))
if can_plot_at_least_one_plot_safely(disk_name):
return disk_name
else:
wp.Logger.bladebit_plotter_logger.log(wp.Logger.WARNING, 'cannot plot on {} disk have not enough space', disk_name)
else:
wp.Logger.bladebit_plotter_logger.log(wp.Logger.FAILED, 'can\'t plot anymore on {}'.format(disk_name))
return None