Remove migration (temporarily), fix a broken test, and make the aggregate size calculation use the entire image ancestry (for now).
This commit is contained in:
parent
b8d88c0f4e
commit
44ff85d044
3 changed files with 9 additions and 26 deletions
|
@ -1454,8 +1454,13 @@ def set_image_size(docker_image_id, namespace_name, repository_name, image_size,
|
|||
ancestors = image.ancestors.split('/')[1:-1]
|
||||
if ancestors:
|
||||
try:
|
||||
parent_image = Image.get(Image.id == ancestors[-1])
|
||||
total_size = image_size + parent_image.storage.aggregate_size
|
||||
# TODO(jschorr): Switch to this faster route once we have full ancestor aggregate_size
|
||||
# parent_image = Image.get(Image.id == ancestors[-1])
|
||||
# total_size = image_size + parent_image.storage.aggregate_size
|
||||
total_size = (ImageStorage.select(fn.Sum(ImageStorage.image_size))
|
||||
.join(Image)
|
||||
.where(Image.id << ancestors)) + image_size
|
||||
|
||||
image.storage.aggregate_size = total_size
|
||||
except Image.DoesNotExist:
|
||||
pass
|
||||
|
|
Reference in a new issue