1

我将我的 celery 从 2.4.X 升级到 celery-2.5.2,然后将 Broker_URL 修改为

BROKER_TRANSPORT = "sqlalchemy"
BROKER_URL = "sqla+mysql://root:root@localhost:3306/db"

此配置可以通过http://docs.celeryproject.org/en/latest/getting-started/brokers/sqlalchemy.html#broker-sqlalchemy的页面引用

Celery 进程可以成功启动,但是我打电话给 . delayapply_async进程将抛出异常KeyError : 'No such transport: mysql' 我对此一无所知.. 看起来一切都应该是正确的。


追溯

回溯(最近一次通话最后):

File "<console>", line 1, in <module>
File "C:\Python27\lib\site-packages\celery-2.5.2-py2.7.egg\celery\app\task\__init__.py", line 353, in delay
   return self.apply_async(args, kwargs)
File "C:\Python27\lib\site-packages\celery-2.5.2-py2.7.egg\celery\app\task\__init__.py", line 449, in apply_async
   publish = publisher or self.app.amqp.publisher_pool.acquire(block=True)
File "C:\Python27\lib\site-packages\kombu-2.1.5-py2.7.egg\kombu\connection.py", line 625, in acquire
   R = self.prepare(R)
File "C:\Python27\lib\site-packages\kombu-2.1.5-py2.7.egg\kombu\pools.py", line 55, in prepare
   p = p()
File "C:\Python27\lib\site-packages\kombu-2.1.5-py2.7.egg\kombu\pools.py", line 46, in <lambda>
   return lambda: self.create_producer()
File "C:\Python27\lib\site-packages\celery-2.5.2-py2.7.egg\celery\app\amqp.py", line 265, in create_producer
   pub = self.app.amqp.TaskPublisher(conn, auto_declare=False)
File "C:\Python27\lib\site-packages\celery-2.5.2-py2.7.egg\celery\app\amqp.py", line 328, in TaskPublisher
   return TaskPublisher(*args, **self.app.merge(defaults, kwargs))
File "C:\Python27\lib\site-packages\celery-2.5.2-py2.7.egg\celery\app\amqp.py", line 158, in __init__
   super(TaskPublisher, self).__init__(*args, **kwargs)
File "C:\Python27\lib\site-packages\kombu-2.1.5-py2.7.egg\kombu\compat.py", line 61, in __init__
   super(Publisher, self).__init__(connection, self.exchange, **kwargs)
File "C:\Python27\lib\site-packages\kombu-2.1.5-py2.7.egg\kombu\messaging.py", line 69, in __init__
   channel = channel.default_channel
File "C:\Python27\lib\site-packages\kombu-2.1.5-py2.7.egg\kombu\connection.py", line 556, in default_channel
   self.connection
File "C:\Python27\lib\site-packages\kombu-2.1.5-py2.7.egg\kombu\connection.py", line 549, in connection
self._connection = self._establish_connection()
File "C:\Python27\lib\site-packages\kombu-2.1.5-py2.7.egg\kombu\connection.py", line 509, in _establish_connection
   conn = self.transport.establish_connection()
File "C:\Python27\lib\site-packages\kombu-2.1.5-py2.7.egg\kombu\connection.py", line 569, in transport
   self._transport = self.create_transport()
File "C:\Python27\lib\site-packages\kombu-2.1.5-py2.7.egg\kombu\connection.py", line 324, in create_transport
   return self.get_transport_cls()(client=self)
File "C:\Python27\lib\site-packages\kombu-2.1.5-py2.7.egg\kombu\connection.py", line 331, in get_transport_cls
   transport_cls = get_transport_cls(transport_cls)
File "C:\Python27\lib\site-packages\kombu-2.1.5-py2.7.egg\kombu\transport__init__.py", line 94, in get_transport_cls
   _transport_cache[transport] = _get_transport_cls(transport)
File "C:\Python27\lib\site-packages\kombu-2.1.5-py2.7.egg\kombu\transport\__init__.py", line 75, in _get_transport_cls
   transport_module_name, transport_cls_name = resolve_transport(transport)
File "C:\Python27\lib\site-packages\kombu-2.1.5-py2.7.egg\kombu\transport\__init__.py", line 70, in resolve_transport
   raise KeyError("No such transport: %s" % (transport, ))
KeyError: 'No such transport: mysql'
4

1 回答 1

2

经过一些调试后,我已将其追踪到kombu正在安装的版本。Kombu 2.1.5 于 4 月 13 日发布,似乎不兼容。我能够通过显式降级到版本 2.1.3 来解决此问题。

于 2012-04-19T14:40:35.983 回答