Merge pull request #2380 from ryanpetrello/noisy-celery-watcher

make celery-watcher less noisy
This commit is contained in:
Ryan Petrello
2018-07-02 11:01:18 -04:00
committed by GitHub

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: