Skip to content

Commit

Permalink
Refactor getting the chunk size, #11556
Browse files Browse the repository at this point in the history
  • Loading branch information
njkim committed Oct 21, 2024
1 parent c1e13a5 commit 55b8c2b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions arches/app/utils/index_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,9 @@ def index_resources_using_singleprocessing(
bar = pyprind.ProgBar(resource_count, bar_char="█", title=title)
else:
bar = None
batch_size = batch_size if batch_size > 8 else 8
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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 55b8c2b

Please sign in to comment.