From 1adc858b6a4e675d44148effc19421390c59d3f8 Mon Sep 17 00:00:00 2001 From: Dave Lawrence Date: Fri, 9 Aug 2024 10:54:56 +0930 Subject: [PATCH] Few subdivide range lock fixes --- annotation/tasks/annotation_scheduler_task.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/annotation/tasks/annotation_scheduler_task.py b/annotation/tasks/annotation_scheduler_task.py index 855e6ea9d..e798fd024 100644 --- a/annotation/tasks/annotation_scheduler_task.py +++ b/annotation/tasks/annotation_scheduler_task.py @@ -100,10 +100,10 @@ def subdivide_annotation_range_lock(arl: AnnotationRangeLock, minimum_size=1000) logging.info("Subdividing %s", arl) # Delete all existing annotation runs - res = arl.annotationrun_set.delete() + res = arl.annotationrun_set.all().delete() logging.info("Deleted attached annotation runs: %s", res) - half_size = size / 1000 + half_size = size / 2 halfway_point = int(arl.min_variant_id) + half_size first_at_or_above_halfway = Variant.objects.filter(pk__gte=halfway_point).order_by("pk").first() first_below_halfway = Variant.objects.filter(pk__gte=arl.min_variant_id, pk__lt=halfway_point).order_by("pk").last()