1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 23:51:09 +03:00

make celery-watcher less noisy

This commit is contained in:
Ryan Petrello 2018-07-02 10:08:02 -04:00
parent 6f63c7ba38
commit a8eb4327ea
No known key found for this signature in database
GPG Key ID: F2AA5F2122351777

View File

@ -2,11 +2,11 @@ import os
import signal import signal
import subprocess import subprocess
import sys import sys
import socket
import time import time
from celery import Celery from celery import Celery
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.conf import settings
class Command(BaseCommand): class Command(BaseCommand):
@ -38,12 +38,10 @@ class Command(BaseCommand):
app.config_from_object('django.conf:settings') app.config_from_object('django.conf:settings')
while True: while True:
try: try:
pongs = app.control.ping(['celery@{}'.format(socket.gethostname())]) pongs = app.control.ping(['celery@{}'.format(settings.CLUSTER_HOST_ID)])
except Exception: except Exception:
pongs = [] pongs = []
if len(pongs): if not pongs:
sys.stderr.write(str(pongs) + '\n')
else:
sys.stderr.write('celery is not responsive to ping over local AMQP\n') sys.stderr.write('celery is not responsive to ping over local AMQP\n')
pid = self.getpid() pid = self.getpid()
if pid: if pid: