From d0395e1f0abd6461508438f746993add3d71d660 Mon Sep 17 00:00:00 2001 From: Namjun Kim Date: Mon, 21 Oct 2024 14:03:48 -0700 Subject: [PATCH] Prevent indexing errors for small batch sizes #11556 (#11557) --- arches/app/utils/index_database.py | 6 +++--- releases/7.6.2.md | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/arches/app/utils/index_database.py b/arches/app/utils/index_database.py index e69a4bb859c..1d0c9cdffcf 100644 --- a/arches/app/utils/index_database.py +++ b/arches/app/utils/index_database.py @@ -262,9 +262,9 @@ def index_resources_using_singleprocessing( bar = pyprind.ProgBar(resource_count, bar_char="█", title=title) else: bar = None - + chunk_size = max(batch_size // 8, 8) for resource in optimize_resource_iteration( - resources, chunk_size=batch_size // 8 + resources, chunk_size=chunk_size ): resource.tiles = resource.prefetched_tiles resource.descriptor_function = resource.graph.descriptor_function @@ -402,7 +402,7 @@ def index_resources_by_type( def _index_resource_batch(resourceids, recalculate_descriptors, quiet=False): resources = Resource.objects.filter(resourceinstanceid__in=resourceids) - batch_size = int(len(resourceids) / 2) + batch_size = max(len(resourceids) // 2, 1) return index_resources_using_singleprocessing( resources=resources, batch_size=batch_size, diff --git a/releases/7.6.2.md b/releases/7.6.2.md index 5bd1d01c200..40577621f5d 100644 --- a/releases/7.6.2.md +++ b/releases/7.6.2.md @@ -6,9 +6,11 @@ - Fixes failure to serialize non-editable Django fields (e.g. auto-date fields) #[11272](https://github.com/archesproject/arches/issues/11272) - Fixes bug in which resource relationships fail to appear in visualize mode if using default deny as a non-superuser #[11539](https://github.com/archesproject/arches/pull/11539) - Fixes bypassing of display logic of details table in search results for client-cached resources #[11537](https://github.com/archesproject/arches/issues/11537) +- Fixes the indexing error when the number of resources in a batch becomes smaller than 8 #[11556](https://github.com/archesproject/arches/issues/11556) - Fail with 404 rather than 500 (AttributeError) for missing search components in search_home route #[11532](https://github.com/archesproject/arches/issues/11532) - Adds an alert message before running the bulk deletion #[11405](https://github.com/archesproject/arches/issues/11405) + ### Dependency changes: ```