File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -140,10 +140,20 @@ def worker_function(chunk, result_queue):
140140 # Start measuring time for the critical work
141141 start = time .perf_counter ()
142142
143+ # Create a progress bar for the total number of queries
144+ total_queries = len (used_queries )
145+ pbar = tqdm .tqdm (total = total_queries , desc = "Processing queries" , unit = "queries" )
146+
143147 # Collect results from all worker processes
144148 results = []
145149 for _ in processes :
146- results .extend (result_queue .get ())
150+ chunk_results = result_queue .get ()
151+ results .extend (chunk_results )
152+ # Update the progress bar with the number of processed queries in this chunk
153+ pbar .update (len (chunk_results ))
154+
155+ # Close the progress bar
156+ pbar .close ()
147157
148158 # Wait for all worker processes to finish
149159 for process in processes :
@@ -192,6 +202,7 @@ def chunked_iterable(iterable, size):
192202
193203def process_chunk (chunk , search_one ):
194204 """Process a chunk of queries using the search_one function."""
205+ # No progress bar in worker processes to avoid cluttering the output
195206 return [search_one (query ) for query in chunk ]
196207
197208
You can’t perform that action at this time.
0 commit comments