From f93d4a4aae2d635a431666757c79aa03fd6dfb71 Mon Sep 17 00:00:00 2001 From: Brian Perrett Date: Mon, 7 Oct 2024 22:09:36 -0700 Subject: [PATCH] retrigger task --- match/tasks.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/match/tasks.py b/match/tasks.py index 42a79944..775c6a35 100644 --- a/match/tasks.py +++ b/match/tasks.py @@ -410,11 +410,9 @@ def huge_match_import_task(hours_thresh=72, exclude_hours=24, break_early=True): qs = qs.select_related("match").order_by('puuid').distinct('puuid') count = qs.count() - remaining_count = count logger.info(f"Found {count} participants for huge_match_import_task.") - while qs.all().exists(): - remaining_count = qs.count() - logger.info(f"Query loop. Found {remaining_count} new participants.") + if count: + logger.info(f"Query loop. Found {count} new participants.") i = -1 elapsed_start = time.perf_counter() @@ -443,10 +441,19 @@ def get_jobs(qs, start_time): if i % 100 == 0: elapsed = time.perf_counter() - elapsed_start time_per_part = elapsed / (i or 1) - estimated_remaining = time_per_part * (remaining_count - i) / 60 - logger.info(f"Finished importing {i} participants of about {remaining_count}.") + estimated_remaining = time_per_part * (count - i) / 60 + logger.info(f"Finished importing {i} participants of about {count}.") logger.info(f"Estimated time remaining for query loop: {estimated_remaining} minutes") + logger.info("Running huge_match_import_task again.") + huge_match_import_task.delay( + hours_thresh=hours_thresh, + exclude_hours=exclude_hours, + break_early=break_early, + ) + else: + logger.info("Not participants found, skipping task.") + logger.info("huge_match_import_task finished.")