[Dashboard] Try to work around aiohttp 4.0.0 breaking changes (#19120)

This commit is contained in:
Carlo Grisetti 2021-10-12 01:25:52 +02:00 committed by GitHub
parent a43193b9e5
commit 2d0355548e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 7 deletions

View file

@ -11,6 +11,7 @@ import time
import traceback import traceback
from grpc.experimental import aio as aiogrpc from grpc.experimental import aio as aiogrpc
from distutils.version import LooseVersion
import ray import ray
import ray.dashboard.consts as dashboard_consts import ray.dashboard.consts as dashboard_consts
@ -143,8 +144,12 @@ class DashboardAgent(object):
sys.exit(-1) sys.exit(-1)
# Create a http session for all modules. # Create a http session for all modules.
# aiohttp<4.0.0 uses a 'loop' variable, aiohttp>=4.0.0 doesn't anymore
if LooseVersion(aiohttp.__version__) < LooseVersion("4.0.0"):
self.http_session = aiohttp.ClientSession( self.http_session = aiohttp.ClientSession(
loop=asyncio.get_event_loop()) loop=asyncio.get_event_loop())
else:
self.http_session = aiohttp.ClientSession()
# Start a grpc asyncio server. # Start a grpc asyncio server.
await self.server.start() await self.server.start()

View file

@ -7,6 +7,7 @@ import ipaddress
import threading import threading
from grpc.experimental import aio as aiogrpc from grpc.experimental import aio as aiogrpc
from distutils.version import LooseVersion
import ray._private.services import ray._private.services
import ray.dashboard.consts as dashboard_consts import ray.dashboard.consts as dashboard_consts
@ -171,8 +172,12 @@ class DashboardHead:
sys.exit(-1) sys.exit(-1)
# Create a http session for all modules. # Create a http session for all modules.
# aiohttp<4.0.0 uses a 'loop' variable, aiohttp>=4.0.0 doesn't anymore
if LooseVersion(aiohttp.__version__) < LooseVersion("4.0.0"):
self.http_session = aiohttp.ClientSession( self.http_session = aiohttp.ClientSession(
loop=asyncio.get_event_loop()) loop=asyncio.get_event_loop())
else:
self.http_session = aiohttp.ClientSession()
# Waiting for GCS is ready. # Waiting for GCS is ready.
self.aiogrpc_gcs_channel = await make_gcs_grpc_channel( self.aiogrpc_gcs_channel = await make_gcs_grpc_channel(

View file

@ -5,7 +5,7 @@
# In short, if you change it here, PLEASE also change it in setup.py. # In short, if you change it here, PLEASE also change it in setup.py.
# #
# setup.py install_requires # setup.py install_requires
aiohttp==3.7 aiohttp>=3.7
aioredis < 2 aioredis < 2
click >= 7.0 click >= 7.0
cloudpickle cloudpickle

View file

@ -1,4 +1,4 @@
aiohttp aiohttp>=3.7
aiohttp_cors aiohttp_cors
aioredis<2 aioredis<2
colorful colorful

View file

@ -190,7 +190,7 @@ if setup_spec.type == SetupType.RAY:
"fsspec", "fsspec",
], ],
"default": [ "default": [
"aiohttp", "aiohttp >= 3.7",
"aiohttp_cors", "aiohttp_cors",
"aioredis < 2", "aioredis < 2",
"colorful", "colorful",