Add time remaining to embedding reindex pane (#14279)

* Add function to convert seconds to human readable duration

* Add estimated time remaining to reindexing pane
This commit is contained in:
Josh Hawkins
2024-10-11 08:04:25 -05:00
committed by GitHub
parent 2897afce41
commit ae91fa6a39
4 changed files with 37 additions and 0 deletions

View File

@@ -175,6 +175,7 @@ class Embeddings:
"descriptions": 0,
"processed_objects": 0,
"total_objects": 0,
"time_remaining": 0,
}
self.requestor.send_data(UPDATE_EMBEDDINGS_REINDEX_PROGRESS, totals)
@@ -229,6 +230,13 @@ class Embeddings:
totals["descriptions"],
)
# Calculate time remaining
elapsed_time = time.time() - st
avg_time_per_event = elapsed_time / totals["processed_objects"]
remaining_events = total_events - totals["processed_objects"]
time_remaining = avg_time_per_event * remaining_events
totals["time_remaining"] = int(time_remaining)
self.requestor.send_data(UPDATE_EMBEDDINGS_REINDEX_PROGRESS, totals)
# Move to the next page