浏览代码

[3.1][worker] Fixes problem with repr(Worker) when blueprint not yet set. Closes #2514

Ask Solem 9 年之前
父节点
当前提交
e884f17587
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      celery/worker/__init__.py

+ 3 - 1
celery/worker/__init__.py

@@ -326,7 +326,9 @@ class WorkController(object):
 
     def __repr__(self):
         return '<Worker: {self.hostname} ({state})>'.format(
-            self=self, state=self.blueprint.human_state(),
+            self=self,
+            state=(self.blueprint.human_state()
+                   if self.blueprint else 'initializing'),  # Issue #2514
         )
 
     def __str__(self):