Explorar o código

More useful logs

Ask Solem %!s(int64=11) %!d(string=hai) anos
pai
achega
e0380ab27b
Modificáronse 2 ficheiros con 12 adicións e 11 borrados
  1. 6 6
      celery/tests/worker/test_consumer.py
  2. 6 5
      celery/worker/consumer.py

+ 6 - 6
celery/tests/worker/test_consumer.py

@@ -386,23 +386,23 @@ class test_Gossip(AppCase):
     def test_on_node_join(self):
         c = self.Consumer()
         g = Gossip(c)
-        with patch('celery.worker.consumer.info') as info:
+        with patch('celery.worker.consumer.debug') as debug:
             g.on_node_join(c)
-            info.assert_called_with('%s joined the party', 'foo@x.com')
+            debug.assert_called_with('%s joined the party', 'foo@x.com')
 
     def test_on_node_leave(self):
         c = self.Consumer()
         g = Gossip(c)
-        with patch('celery.worker.consumer.info') as info:
+        with patch('celery.worker.consumer.debug') as debug:
             g.on_node_leave(c)
-            info.assert_called_with('%s left', 'foo@x.com')
+            debug.assert_called_with('%s left', 'foo@x.com')
 
     def test_on_node_lost(self):
         c = self.Consumer()
         g = Gossip(c)
-        with patch('celery.worker.consumer.warn') as warn:
+        with patch('celery.worker.consumer.info') as info:
             g.on_node_lost(c)
-            warn.assert_called_with('%s went missing!', 'foo@x.com')
+            info.assert_called_with('missed heartbeat from %s', 'foo@x.com')
 
     def test_register_timer(self):
         c = self.Consumer()

+ 6 - 5
celery/worker/consumer.py

@@ -688,13 +688,13 @@ class Gossip(bootsteps.ConsumerStep):
             self.consensus_replies.pop(id, None)
 
     def on_node_join(self, worker):
-        info('%s joined the party', worker.hostname)
+        debug('%s joined the party', worker.hostname)
 
     def on_node_leave(self, worker):
-        info('%s left', worker.hostname)
+        debug('%s left', worker.hostname)
 
     def on_node_lost(self, worker):
-        warn('%s went missing!', worker.hostname)
+        info('missed heartbeat from %s', worker.hostname)
 
     def register_timer(self):
         if self._tref is not None:
@@ -765,8 +765,8 @@ class Mingle(bootsteps.StartStopStep):
         replies = I.hello(c.hostname, revoked._data) or {}
         replies.pop(c.hostname, None)
         if replies:
-            info('mingle: hello %s! sync with me',
-                 ', '.join(reply for reply, value in items(replies) if value))
+            info('mingle: sync with %s nodes',
+                 len([reply for reply, value in items(replies) if value]))
             for reply in values(replies):
                 if reply:
                     try:
@@ -776,6 +776,7 @@ class Mingle(bootsteps.StartStopStep):
                     else:
                         c.app.clock.adjust(other_clock)
                         revoked.update(other_revoked)
+            info('mingle: sync complete')
         else:
             info('mingle: all alone')