Skip to content

Run create_missing_detection_images as a periodic tasks #1170

@mihow

Description

@mihow

Summary

If an image processing job gets interrupted, the thumbnail images of the detections may be missing. There is a management command to fill-in missing images, however it must be run manually by system admins. This could be run as a periodic task, or another automated hook.

Image

ami/ml/management/commands/create_missing_detection_images.py

The underlying function is already extracted here:

antenna/ami/ml/media.py

Lines 17 to 25 in 81a7864

def get_source_images_with_missing_detection_images(
queryset: QuerySet[SourceImage] | None = None, batch_size: int = 100
) -> QuerySet[SourceImage]:
if queryset is None:
queryset = SourceImage.objects.all()
return queryset.filter(
Exists(Detection.objects.filter(source_image=OuterRef("pk"), path__isnull=True))
).prefetch_related("detections", "deployment__project")[:batch_size]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions