-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use celery-beat to schedule tool deletes (#1472)
* Use celery-beat to schedule tool deletes * Add readiness mgmt command for celery beat Uses similar logic to celery for now. When celery beat init signal is sent, we create a file. The management command checks for the prescence of this file. * Update launch.json.example to add celery beat
- Loading branch information
1 parent
05a837a
commit f273481
Showing
9 changed files
with
104 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
controlpanel/frontend/management/commands/celery_beat_health.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Standard library | ||
import random | ||
from datetime import datetime, timedelta | ||
from pathlib import Path | ||
from sys import exit | ||
|
||
# Third-party | ||
from django.conf import settings | ||
from django.core.management.base import BaseCommand | ||
|
||
# First-party/Local | ||
from controlpanel.celery import worker_health_check | ||
|
||
|
||
class Command(BaseCommand): | ||
help = "Checks if celery beat is ready by checking for heath file" | ||
|
||
def handle(self, *args, **options): | ||
|
||
if not Path(settings.WORKER_HEALTH_FILENAME).is_file(): | ||
self.stderr.write(self.style.ERROR("Health file not found")) | ||
exit(-1) | ||
|
||
self.stdout.write(self.style.SUCCESS("Health file found")) | ||
exit(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters