Browse Source

Fix for write_stats error when using threads pool. Closes #1631

Ask Solem 11 years ago
parent
commit
6b054bd5fe
1 changed files with 5 additions and 1 deletions
  1. 5 1
      celery/concurrency/prefork.py

+ 5 - 1
celery/concurrency/prefork.py

@@ -159,6 +159,10 @@ class TaskPool(BasePool):
             self._pool.close()
 
     def _get_info(self):
+        try:
+            write_stats = self._pool.human_write_stats
+        except AttributeError:
+            write_stats = lambda: 'N/A'  # only supported by asynpool
         return {
             'max-concurrency': self.limit,
             'processes': [p.pid for p in self._pool._pool],
@@ -166,7 +170,7 @@ class TaskPool(BasePool):
             'put-guarded-by-semaphore': self.putlocks,
             'timeouts': (self._pool.soft_timeout or 0,
                          self._pool.timeout or 0),
-            'writes': self._pool.human_write_stats(),
+            'writes': write_stats()
         }
 
     @property