فهرست منبع

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

Ask Solem 15 سال پیش
والد
کامیت
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"],