Skip to content

Commit

Permalink
Merge pull request #10790 from archesproject/jtw/index-progress-bar
Browse files Browse the repository at this point in the history
Use count() for indexing progress bar re #10453
  • Loading branch information
whatisgalen authored Apr 22, 2024
2 parents ca5a464 + f102945 commit 8d49ccf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion arches/app/utils/index_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,14 @@ def index_resources_using_singleprocessing(
with se.BulkIndexer(batch_size=batch_size, refresh=True) as doc_indexer:
with se.BulkIndexer(batch_size=batch_size, refresh=True) as term_indexer:
if quiet is False:
bar = pyprind.ProgBar(len(resources), bar_char="█", title=title) if len(resources) > 1 else None
if isinstance(resources, QuerySet):
resource_count = resources.count()
else:
resource_count = len(resources)
if resource_count > 1:
bar = pyprind.ProgBar(resource_count, bar_char="█", title=title)
else:
bar = None

for resource in optimize_resource_iteration(resources, chunk_size=batch_size // 8):
resource.tiles = resource.prefetched_tiles
Expand Down

0 comments on commit 8d49ccf

Please sign in to comment.