Python 3.x 如何让dramatiq在Windows/WSL环境中与redis协同工作?

Python 3.x 如何让dramatiq在Windows/WSL环境中与redis协同工作?,python-3.x,windows,redis,windows-subsystem-for-linux,dramatiq,Python 3.x,Windows,Redis,Windows Subsystem For Linux,Dramatiq,我创建了一个简单的脚本,用于使用redis测试戏剧性: broker_redis = RedisBroker(host='localhost', port=6379) @dramatiq.actor def sq(x): time.sleep(random.randint(2, 4)) return x * x 我正在使用此命令在WSL内部运行(如文档所述): 它运行时没有任何错误,并在控制台上打印以下行: [2020-05-06 09:46:28,535] [PID 508

我创建了一个简单的脚本,用于使用redis测试戏剧性:

broker_redis = RedisBroker(host='localhost', port=6379)

@dramatiq.actor
def sq(x):
    time.sleep(random.randint(2, 4))
    return x * x
我正在使用此命令在WSL内部运行(如文档所述):

它运行时没有任何错误,并在控制台上打印以下行:

[2020-05-06 09:46:28,535] [PID 508] [MainThread] [dramatiq.MainProcess] [INFO] Dramatiq '1.8.1' is booting up.
[2020-05-06 09:46:28,535] [PID 511] [MainThread] [dramatiq.WorkerProcess(1)] [INFO] Worker process is ready for action.
[2020-05-06 09:46:28,546] [PID 510] [MainThread] [dramatiq.WorkerProcess(0)] [INFO] Worker process is ready for action.
[2020-05-06 09:46:28,548] [PID 544] [MainThread] [dramatiq.ForkProcess(0)] [INFO] Fork process 'dramatiq.middleware.prometheus:_run_exposition_server' is ready for action.
[2020-05-06 09:46:28,559] [PID 513] [MainThread] [dramatiq.WorkerProcess(3)] [INFO] Worker process is ready for action.
[2020-05-06 09:46:28,569] [PID 512] [MainThread] [dramatiq.WorkerProcess(2)] [INFO] Worker process is ready for action.
[2020-05-06 09:46:28,581] [PID 515] [MainThread] [dramatiq.WorkerProcess(5)] [INFO] Worker process is ready for action.
[2020-05-06 09:46:28,596] [PID 514] [MainThread] [dramatiq.WorkerProcess(4)] [INFO] Worker process is ready for action.
[2020-05-06 09:46:28,634] [PID 516] [MainThread] [dramatiq.WorkerProcess(6)] [INFO] Worker process is ready for action.
[2020-05-06 09:46:28,634] [PID 517] [MainThread] [dramatiq.WorkerProcess(7)] [INFO] Worker process is ready for action.
但当我在解释器中导入此函数并对其使用
send
方法时

from script_name import sq
sq.send(10)
…它等待几秒钟,然后引发一个
戏剧性错误。ConnectionClosed
错误:

dramatiq.errors.ConnectionClosed: AMQPConnectionError: (AMQPConnectorSocketConnectError: ConnectionRefusedError(10061, 'Unknown error'),)
此调用似乎无法将消息发送到WSL内部运行的戏剧TIQ


注意:我还没有安装RabbitMQ,但我假设如果我要使用Redis,就不需要安装它。

您有运行Redis吗?如果您要使用RabbitMQ,也一样,您需要运行RabbitMQ服务。
dramatiq.errors.ConnectionClosed: AMQPConnectionError: (AMQPConnectorSocketConnectError: ConnectionRefusedError(10061, 'Unknown error'),)