You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jumpserver/apps/ops/management/commands/check_celery.py

21 lines
575 B

from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
help = 'Ops manage commands'
def add_arguments(self, parser):
parser.add_argument('check_celery', nargs='?', help='Check celery health')
def handle(self, *args, **options):
from ops.celery.utils import get_celery_status, get_beat_status
ok = get_celery_status()
if not ok:
raise CommandError('Celery worker unhealthy')
ok = get_beat_status()
if not ok:
raise CommandError('Beat unhealthy')