Further merge fixes
This commit is contained in:
parent
7816b0c657
commit
030c69d7d2
3 changed files with 22 additions and 28 deletions
|
@ -576,10 +576,6 @@ class Image(BaseModel):
|
||||||
security_indexed_engine = IntegerField(default=-1)
|
security_indexed_engine = IntegerField(default=-1)
|
||||||
parent_id = IntegerField(index=True, null=True)
|
parent_id = IntegerField(index=True, null=True)
|
||||||
|
|
||||||
security_indexed = BooleanField(default=False)
|
|
||||||
security_indexed_engine = IntegerField(default=-1)
|
|
||||||
parent = ForeignKeyField('self', index=True, null=True, related_name='children')
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
database = db
|
database = db
|
||||||
read_slaves = (read_slave,)
|
read_slaves = (read_slave,)
|
||||||
|
|
|
@ -99,10 +99,6 @@ def __create_subtree(repo, structure, creator_username, parent, tag_map):
|
||||||
new_image.security_indexed_engine = -1
|
new_image.security_indexed_engine = -1
|
||||||
new_image.save()
|
new_image.save()
|
||||||
|
|
||||||
new_image.security_indexed = False
|
|
||||||
new_image.security_indexed_engine = maxsize
|
|
||||||
new_image.save()
|
|
||||||
|
|
||||||
creation_time = REFERENCE_DATE + timedelta(weeks=image_num) + timedelta(days=model_num)
|
creation_time = REFERENCE_DATE + timedelta(weeks=image_num) + timedelta(days=model_num)
|
||||||
command_list = SAMPLE_CMDS[image_num % len(SAMPLE_CMDS)]
|
command_list = SAMPLE_CMDS[image_num % len(SAMPLE_CMDS)]
|
||||||
command = json.dumps(command_list) if command_list else None
|
command = json.dumps(command_list) if command_list else None
|
||||||
|
|
|
@ -31,14 +31,13 @@ def _get_images_to_export_list(version):
|
||||||
|
|
||||||
# Collect the images without parents
|
# Collect the images without parents
|
||||||
candidates = (Image
|
candidates = (Image
|
||||||
.select(Image.docker_image_id, ImageStorage.uuid, ImageStorage.checksum)
|
.select(Image.id, Image.docker_image_id, ImageStorage.uuid)
|
||||||
.join(ImageStorage)
|
.join(ImageStorage)
|
||||||
.where(Image.security_indexed_engine < version,
|
.where(Image.security_indexed_engine < version,
|
||||||
Image.parent_id >> None,
|
Image.parent_id >> None,
|
||||||
ImageStorage.uploading == False,
|
ImageStorage.uploading == False)
|
||||||
ImageStorage.checksum != '')
|
.limit(BATCH_SIZE*10)
|
||||||
.limit(BATCH_SIZE*10)
|
.alias('candidates'))
|
||||||
.alias('candidates'))
|
|
||||||
|
|
||||||
images = (Image
|
images = (Image
|
||||||
.select(candidates.c.id, candidates.c.docker_image_id, candidates.c.uuid)
|
.select(candidates.c.id, candidates.c.docker_image_id, candidates.c.uuid)
|
||||||
|
@ -56,18 +55,21 @@ def _get_images_to_export_list(version):
|
||||||
|
|
||||||
# Collect the images with analyzed parents.
|
# Collect the images with analyzed parents.
|
||||||
candidates = (Image
|
candidates = (Image
|
||||||
.select(Image.docker_image_id, ImageStorage.uuid, ImageStorage.checksum, Parent.docker_image_id.alias('parent_docker_image_id'), ParentImageStorage.uuid.alias('parent_storage_uuid'))
|
.select(Image.id,
|
||||||
.join(Parent, on=(Image.parent_id == Parent.id))
|
Image.docker_image_id,
|
||||||
.join(ParentImageStorage, on=(ParentImageStorage.id == Parent.storage))
|
ImageStorage.uuid,
|
||||||
.switch(Image)
|
Parent.docker_image_id.alias('parent_docker_image_id'),
|
||||||
.join(ImageStorage)
|
ParentImageStorage.uuid.alias('parent_storage_uuid'))
|
||||||
.where(Image.security_indexed_engine < version,
|
.join(Parent, on=(Image.parent_id == Parent.id))
|
||||||
Parent.security_indexed == True,
|
.join(ParentImageStorage, on=(ParentImageStorage.id == Parent.storage))
|
||||||
Parent.security_indexed_engine >= version,
|
.switch(Image)
|
||||||
ImageStorage.uploading == False,
|
.join(ImageStorage)
|
||||||
ImageStorage.checksum != '')
|
.where(Image.security_indexed_engine < version,
|
||||||
.limit(BATCH_SIZE*10)
|
Parent.security_indexed == True,
|
||||||
.alias('candidates'))
|
Parent.security_indexed_engine >= version,
|
||||||
|
ImageStorage.uploading == False)
|
||||||
|
.limit(BATCH_SIZE*10)
|
||||||
|
.alias('candidates'))
|
||||||
|
|
||||||
images = (Image
|
images = (Image
|
||||||
.select(candidates.c.id,
|
.select(candidates.c.id,
|
||||||
|
|
Reference in a new issue