소스 검색

celery inspect|status|control now shows error if SQL transport used

Ask Solem 12 년 전
부모
커밋
56213cdcd4
1개의 변경된 파일8개의 추가작업 그리고 1개의 파일을 삭제
  1. 8 1
      celery/bin/celery.py

+ 8 - 1
celery/bin/celery.py

@@ -63,6 +63,11 @@ def determine_exit_status(ret):
     return EX_OK if ret else EX_FAILURE
 
 
+def ensure_broadcast_supported(app):
+    if app.connection().transport.driver_type == 'sql':
+        raise Error('SQL broker transports does not support broadcast')
+
+
 def main(argv=None):
     # Fix for setuptools generated scripts, so that it will
     # work with multiprocessing fork emulation.
@@ -305,6 +310,8 @@ class _RemoteControl(Command):
         if method not in self.choices:
             raise Error('Unknown {0.name} method {1}'.format(self, method))
 
+        ensure_broadcast_supported(self.app)
+
         destination = kwargs.get('destination')
         timeout = kwargs.get('timeout') or self.choices[method][0]
         if destination and isinstance(destination, string_t):
@@ -674,7 +681,7 @@ class CeleryCommand(Command):
             return cls(app=self.app).run_from_argv(
                 self.prog_name, argv[1:], command=argv[0],
             )
-        except Error:
+        except (TypeError, Error):
             return self.execute('help', argv)
 
     def remove_options_at_beginning(self, argv, index=0):