Further merge fixes

This commit is contained in:
Joseph Schorr 2015-11-12 21:59:52 -05:00
parent 7816b0c657
commit 030c69d7d2
3 changed files with 22 additions and 28 deletions

View file

@ -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,)

View file

@ -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

View file

@ -31,12 +31,11 @@ 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'))
@ -56,7 +55,11 @@ 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,
Image.docker_image_id,
ImageStorage.uuid,
Parent.docker_image_id.alias('parent_docker_image_id'),
ParentImageStorage.uuid.alias('parent_storage_uuid'))
.join(Parent, on=(Image.parent_id == Parent.id)) .join(Parent, on=(Image.parent_id == Parent.id))
.join(ParentImageStorage, on=(ParentImageStorage.id == Parent.storage)) .join(ParentImageStorage, on=(ParentImageStorage.id == Parent.storage))
.switch(Image) .switch(Image)
@ -64,8 +67,7 @@ def _get_images_to_export_list(version):
.where(Image.security_indexed_engine < version, .where(Image.security_indexed_engine < version,
Parent.security_indexed == True, Parent.security_indexed == True,
Parent.security_indexed_engine >= version, Parent.security_indexed_engine >= version,
ImageStorage.uploading == False, ImageStorage.uploading == False)
ImageStorage.checksum != '')
.limit(BATCH_SIZE*10) .limit(BATCH_SIZE*10)
.alias('candidates')) .alias('candidates'))