Skip to content

Record start time before query processing starts #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: update.redisearch
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions engine/base_client/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,37 +163,32 @@ def worker_function(chunk, result_queue):
# Create a queue to collect results
result_queue = Queue()

# Create and start worker processes
# Create worker processes
processes = []
for chunk in query_chunks:
process = Process(target=worker_function, args=(chunk, result_queue))
processes.append(process)
process.start()

# Start measuring time for the critical work
start = time.perf_counter()

# Create a progress bar for the total number of queries
pbar = tqdm.tqdm(total=total_query_count, desc="Processing queries", unit="queries")
# Start worker processes
for process in processes:
process.start()

# Collect results from all worker processes
results = []
for _ in processes:
chunk_results = result_queue.get()
results.extend(chunk_results)
# Update the progress bar with the number of processed queries in this chunk
pbar.update(len(chunk_results))

# Close the progress bar
pbar.close()
# Stop measuring time for the critical work
total_time = time.perf_counter() - start

# Wait for all worker processes to finish
for process in processes:
process.join()

# Stop measuring time for the critical work
total_time = time.perf_counter() - start

# Extract precisions and latencies (outside the timed section)
precisions, latencies = zip(*results)

Expand Down