Skip to content

Commit

Permalink
Decorate jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jongmassey committed Jul 16, 2024
1 parent d653659 commit b340ca0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions jobserver/jobs/daily/clearsessions.py
Original file line number Diff line number Diff line change
@@ -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")
2 changes: 2 additions & 0 deletions jobserver/jobs/daily/update_repo_has_github_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from jobserver.github import _get_github_api
from jobserver.models import Repo
from services.sentry import monitor


def topics(data):
Expand All @@ -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!) {
Expand Down
3 changes: 3 additions & 0 deletions jobserver/jobs/hourly/dump_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit b340ca0

Please sign in to comment.