Migrate old data to new locations, read only new.
This commit is contained in:
parent
0316f6e471
commit
8baacd2741
10 changed files with 204 additions and 44 deletions
|
@ -79,7 +79,14 @@ def get_repository_images_base(namespace_name, repository_name, query_modifier):
|
|||
|
||||
query = query_modifier(query)
|
||||
|
||||
location_list = list(query)
|
||||
return invert_placement_query_results(query)
|
||||
|
||||
|
||||
def invert_placement_query_results(placement_query):
|
||||
""" This method will take a query which returns placements, storages, and images, and have it
|
||||
return images and their storages, along with the placement set on each storage.
|
||||
"""
|
||||
location_list = list(placement_query)
|
||||
|
||||
images = {}
|
||||
for location in location_list:
|
||||
|
@ -326,7 +333,7 @@ def set_image_size(docker_image_id, namespace_name, repository_name, image_size,
|
|||
try:
|
||||
# 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 = image_size + parent_image.aggregate_size
|
||||
total_size = (ImageStorage
|
||||
.select(fn.Sum(ImageStorage.image_size))
|
||||
.join(Image)
|
||||
|
|
Reference in a new issue