当使用baseproxy使用Python多处理管理器时,如何修复损坏的管道?

2024-07-03 04:23:48 发布

您现在位置:Python中文网/ 问答频道 /正文

Broken Pipe when Using Python Multiprocessing Managers (BaseManager/SyncManager) to Share Queue with Remote Machines中,建议我们添加: 在重新连接之前删除缓存的连接。将代码添加到引发异常的行上的try except子句中,然后重试。你知道吗

如果我使用pool和pool.apply_async,我应该怎么做?你知道吗

from multiprocessing.managers import BaseProxy

...

if address in BaseProxy._address_to_local:
    del BaseProxy._address_to_local[address][0].connection

Tags: tosharequeueaddresslocalmultiprocessingmanagerswhen