Skip to content

Commit

Permalink
move grad_users script to cronjob
Browse files Browse the repository at this point in the history
  • Loading branch information
rm03 committed Sep 28, 2024
1 parent 9612017 commit e5d0759
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 0 additions & 1 deletion backend/clubs/management/commands/graduate_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class Command(BaseCommand):
"Mark all memberships where the student has graduated as inactive. "
"This script should be run at the beginning of each year."
)
web_execute = True

def handle(self, *args, **kwargs):
now = timezone.now()
Expand Down
2 changes: 1 addition & 1 deletion backend/tests/clubs/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2600,7 +2600,7 @@ def test_execute_script(self):
self.assertIn(resp.status_code, [200], resp.content)
self.assertIsInstance(resp.data, list, resp.content)

resp = self.client.post(reverse("scripts"), {"action": "graduate_users"})
resp = self.client.post(reverse("scripts"), {"action": "find_broken_images"})
self.assertIn(resp.status_code, [200], resp.content)
self.assertIn("output", resp.data, resp.content)

Expand Down
7 changes: 7 additions & 0 deletions k8s/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ export class MyChart extends PennLabsChart {
secret: clubsSecret,
cmd: ["python", "manage.py", "expire_membership_invites"],
});

new CronJob(this, 'graduate-users', {
schedule: cronTime.everyYearIn(1, 1, 12, 0),
image: backendImage,
secret: clubsSecret,
cmd: ["python", "manage.py", "graduate_users"],
});
}
}

Expand Down

0 comments on commit e5d0759

Please sign in to comment.