From b340ca09523deb5db3d59fa17aea33c002fc4fef Mon Sep 17 00:00:00 2001 From: Jon Massey Date: Tue, 16 Jul 2024 23:38:29 +0100 Subject: [PATCH] Decorate jobs --- jobserver/jobs/daily/clearsessions.py | 3 +++ jobserver/jobs/daily/update_repo_has_github_outputs.py | 2 ++ jobserver/jobs/hourly/dump_db.py | 3 +++ .../jobs/weekly/notify_impending_copilot_support_windows.py | 2 ++ 4 files changed, 10 insertions(+) diff --git a/jobserver/jobs/daily/clearsessions.py b/jobserver/jobs/daily/clearsessions.py index 0ea23545b5..a51a171702 100644 --- a/jobserver/jobs/daily/clearsessions.py +++ b/jobserver/jobs/daily/clearsessions.py @@ -1,9 +1,12 @@ from django.core.management import call_command from django_extensions.management.jobs import DailyJob +from services.sentry import monitor + class Job(DailyJob): help = "Run the clearsessions management command" # noqa: A003 + @monitor() def execute(self): call_command("clearsessions") diff --git a/jobserver/jobs/daily/update_repo_has_github_outputs.py b/jobserver/jobs/daily/update_repo_has_github_outputs.py index e3622935b9..cae2a05b98 100644 --- a/jobserver/jobs/daily/update_repo_has_github_outputs.py +++ b/jobserver/jobs/daily/update_repo_has_github_outputs.py @@ -3,6 +3,7 @@ from jobserver.github import _get_github_api from jobserver.models import Repo +from services.sentry import monitor def topics(data): @@ -15,6 +16,7 @@ def topics(data): class Job(DailyJob): help = "Dump the database to storage for copying to local dev environments" # noqa: A003 + @monitor def execute(self): query = """ query reposWithTopics($cursor: String, $org_name: String!) { diff --git a/jobserver/jobs/hourly/dump_db.py b/jobserver/jobs/hourly/dump_db.py index be84738721..2fb0330518 100644 --- a/jobserver/jobs/hourly/dump_db.py +++ b/jobserver/jobs/hourly/dump_db.py @@ -5,10 +5,13 @@ from django.conf import settings from django_extensions.management.jobs import HourlyJob +from services.sentry import monitor + class Job(HourlyJob): help = "Dump the database to storage for copying to local dev environments" # noqa: A003 + @monitor def execute(self): db = settings.DATABASES["default"] output = pathlib.Path("/storage/jobserver.dump") diff --git a/jobserver/jobs/weekly/notify_impending_copilot_support_windows.py b/jobserver/jobs/weekly/notify_impending_copilot_support_windows.py index 1d5fc196dc..57533c0253 100644 --- a/jobserver/jobs/weekly/notify_impending_copilot_support_windows.py +++ b/jobserver/jobs/weekly/notify_impending_copilot_support_windows.py @@ -3,11 +3,13 @@ from django_extensions.management.jobs import WeeklyJob from jobserver.copiloting import notify_impending_copilot_windows_closing +from services.sentry import monitor class Job(WeeklyJob): help = "Notify slack of impending co-pilot support windows ending" # noqa: A003 + @monitor def execute(self): try: notify_impending_copilot_windows_closing()