From f9ad4e05867cf6b42d8528b4250a7d34ef7b808f Mon Sep 17 00:00:00 2001 From: Ludwig Kristoffersson Date: Wed, 8 Mar 2023 22:28:02 +0100 Subject: [PATCH] add dispatch_analysis_for_all_lectures command that schedules analysis of all ready lectures --- jobs/cmd.py | 10 ++++++++++ setup.py | 1 + 2 files changed, 11 insertions(+) diff --git a/jobs/cmd.py b/jobs/cmd.py index 293bac9..d1aa2eb 100644 --- a/jobs/cmd.py +++ b/jobs/cmd.py @@ -5,6 +5,7 @@ get_all_lectures, ) from jobs import ( + schedule_analysis_of_lecture, schedule_cleanup_of_lecture, get_metadata_queue, capture_preview, @@ -55,3 +56,12 @@ def cleanup_for_all_lectures(): for lecture in lectures: print(f'scheduling clean of {lecture.id}') schedule_cleanup_of_lecture(lecture) + + +def reanalyse_all_lectures(): + print('dispatching jobs to re-analyse all lectures') + + lectures = get_all_ready_lectures() + for lecture in lectures: + print(f'scheduling analysis of {lecture.id}') + schedule_analysis_of_lecture(lecture) diff --git a/setup.py b/setup.py index 37358de..beabbf1 100644 --- a/setup.py +++ b/setup.py @@ -38,6 +38,7 @@ 'invalidate_query_cache = db.cmd:invalidate_all_query_caches', 'analysis_queues_restart = jobs:analysis_queues_restart', 'dispatch_fetch_metadata_for_all_lectures = jobs.cmd:fetch_metadata_for_all_lectures', + 'dispatch_analysis_for_all_lectures = jobs.cmd:reanalyse_all_lectures', 'dispatch_capture_preview_for_all_lectures = jobs.cmd:capture_preview_for_all_lectures', 'dispatch_cleanup_for_all_lectures = jobs.cmd:cleanup_for_all_lectures', 'fetch_kth_courses = courses.cmd:fetch_kth_courses',