Browse Source

Fix GiBs in the "insufficient disk space" message (#187)

Alexander Borzunov 2 years ago
parent
commit
16b69d6050
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/petals/utils/disk_cache.py

+ 2 - 2
src/petals/utils/disk_cache.py

@@ -73,14 +73,14 @@ def free_disk_space_for(
         if freed_space >= extra_space_needed:
             break
 
+    gib = 1024**3
     if pending_removal:
-        gib = 1024**3
         logger.info(f"Removing {len(pending_removal)} blocks to free {freed_space / gib:.1f} GiB of disk space")
         delete_strategy = cache_info.delete_revisions(*pending_removal)
         delete_strategy.execute()
 
     if freed_space < extra_space_needed:
         raise RuntimeError(
-            f"Insufficient disk space to load a block. Please free {extra_space_needed - freed_space:.1f} GiB "
+            f"Insufficient disk space to load a block. Please free {(extra_space_needed - freed_space) / gib:.1f} GiB "
             f"on the volume for {cache_dir} or increase --max_disk_space if you set it manually"
         )