Add a tool to compute how much storage shared images have saved us.
This commit is contained in:
parent
536a91cbb8
commit
75d0b34f4b
1 changed files with 14 additions and 0 deletions
14
tools/sharedimagestorage.py
Normal file
14
tools/sharedimagestorage.py
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
from data.database import Image, ImageStorage
|
||||||
|
|
||||||
|
query = ImageStorage.select().annotate(Image)
|
||||||
|
|
||||||
|
saved_bytes = 0
|
||||||
|
total_bytes = 0
|
||||||
|
|
||||||
|
for storage in query:
|
||||||
|
if storage.image_size is not None:
|
||||||
|
saved_bytes += (storage.count - 1) * storage.image_size
|
||||||
|
total_bytes += storage.count * storage.image_size
|
||||||
|
|
||||||
|
print "Saved: %s" % saved_bytes
|
||||||
|
print "Total: %s" % total_bytes
|
Reference in a new issue