ソースを参照

Worker control command execution now catches exceptions and returns them in
the (optional) reply.

Ask Solem 14 年 前
コミット
cd4fb8cd2e
1 ファイル変更7 行追加1 行削除
  1. 7 1
      celery/worker/control/__init__.py

+ 7 - 1
celery/worker/control/__init__.py

@@ -57,7 +57,13 @@ class ControlDispatch(object):
         except KeyError:
             self.logger.error("No such control command: %s" % command)
         else:
-            reply = control(self.panel, **kwdict(kwargs))
+            try:
+                reply = control(self.panel, **kwdict(kwargs))
+            except Exception, exc:
+                self.logger.error(
+                        "Error running control command %s kwargs=%s: %s" % (
+                            command, kwargs, exc))
+                reply = {"error": str(exc)}
             if reply_to:
                 self.reply({self.hostname: reply},
                            exchange=reply_to["exchange"],