[Core] remove Windows compatibility for Redis (#23991)

There should be no reference to Redis in Python anymore except parts of bootstrap code path.

closes #23982
This commit is contained in:
mwtian 2022-04-19 09:16:47 -07:00 committed by GitHub
parent 9de391b70e
commit 2a5c40a149
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 1 additions and 30 deletions

View file

@ -83,11 +83,6 @@ def _configure_system():
)
sys.path.insert(0, thirdparty_files)
if sys.platform == "win32":
import ray._private.compat # noqa: E402
ray._private.compat.patch_redis_empty_recv()
if (
platform.system() == "Linux"
and "Microsoft".lower() in platform.release().lower()

View file

@ -1,28 +1,5 @@
import errno
import io
import platform
import socket
import sys
def patch_redis_empty_recv():
"""On Windows, socket disconnect result in errors rather than empty reads.
redis-py does not handle these errors correctly.
This patch translates connection resets to empty reads as in POSIX.
"""
assert sys.platform == "win32"
import redis
def redis_recv(sock, *args, **kwargs):
result = b""
try:
result = redis._compat.recv(sock, *args, **kwargs)
except socket.error as ex:
if ex.errno not in [errno.ECONNRESET, errno.ECONNREFUSED]:
raise
return result
redis.connection.recv = redis_recv
def patch_psutil():

View file

@ -6,7 +6,6 @@
#
# setup.py install_requires
aiohttp>=3.7
aioredis < 2
aiosignal
click >= 7.0, <= 8.0.4
cloudpickle
@ -23,7 +22,6 @@ protobuf >= 3.8.0
py-spy >= 0.2.0
pydantic >= 1.8
pyyaml
redis >= 3.5.0, < 4.0.0
requests
smart_open
virtualenv
@ -83,6 +81,7 @@ pytest-sugar
pytest-lazy-fixture
pytest-timeout
pytest-virtualenv
redis >= 3.5.0, < 4.0.0
scikit-learn==0.22.2
testfixtures
werkzeug