From 70644a9cb8b70c3899dd33cce26a5107a977c252 Mon Sep 17 00:00:00 2001 From: Shiva Menta Date: Mon, 18 Nov 2024 23:00:33 -0500 Subject: [PATCH] Add Cronjob --- backend/courses/management/commands/sync_path_status.py | 2 +- k8s/main.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/backend/courses/management/commands/sync_path_status.py b/backend/courses/management/commands/sync_path_status.py index 111c5c32..d74ca12f 100644 --- a/backend/courses/management/commands/sync_path_status.py +++ b/backend/courses/management/commands/sync_path_status.py @@ -172,7 +172,7 @@ def resolve_path_differences(send_data_to_slack=False, verbose=False): url, data=json.dumps( { - "text": f"{len(inconsistent_courses)} inconsistent Course " + "text": f"{len(inconsistent_courses)} Inconsistent Course " + f"Statuses Resolved: {inconsistent_courses}" } ), diff --git a/k8s/main.ts b/k8s/main.ts index ad6d86c1..1b2dbb0d 100644 --- a/k8s/main.ts +++ b/k8s/main.ts @@ -139,6 +139,13 @@ export class MyChart extends PennLabsChart { secret, cmd: ['python', 'manage.py', 'alertstats', '1', '--slack'], }) + + new CronJob(this, 'sync-path-course-statuses', { + schedule: cronTime.everyHour(), + image: backendImage, + secret, + cmd: ['python', 'manage.py', 'sync_path_status', '--slack'], + }) } }