From a8eb4327ea92991d085b65ab16d142bc17f8b6b3 Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Mon, 2 Jul 2018 10:08:02 -0400 Subject: [PATCH] make celery-watcher less noisy --- awx/main/management/commands/watch_celery.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/awx/main/management/commands/watch_celery.py b/awx/main/management/commands/watch_celery.py index c991164045..6da5bef2f4 100644 --- a/awx/main/management/commands/watch_celery.py +++ b/awx/main/management/commands/watch_celery.py @@ -2,11 +2,11 @@ import os import signal import subprocess import sys -import socket import time from celery import Celery from django.core.management.base import BaseCommand +from django.conf import settings class Command(BaseCommand): @@ -38,12 +38,10 @@ class Command(BaseCommand): app.config_from_object('django.conf:settings') while True: try: - pongs = app.control.ping(['celery@{}'.format(socket.gethostname())]) + pongs = app.control.ping(['celery@{}'.format(settings.CLUSTER_HOST_ID)]) except Exception: pongs = [] - if len(pongs): - sys.stderr.write(str(pongs) + '\n') - else: + if not pongs: sys.stderr.write('celery is not responsive to ping over local AMQP\n') pid = self.getpid() if pid: