Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: aiohttp-3.9.1 update #1855

Merged
merged 4 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/1855.misc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update aiohttp to 3.9.1 and workaround mypy `TCPConnector` ssl keyword argument type by add custom type `SSLContextType`
863 changes: 413 additions & 450 deletions python.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
aiodataloader-ng~=0.2.1
aiodocker~=0.21.0
aiofiles~=0.8.0
aiohttp~=3.8.1
aiohttp~=3.9.1
aiohttp_cors~=0.7
aiohttp_sse>=2.0
aiodns>=3.0
aiomonitor~=0.6.0
aiomonitor~=0.7.0
aioresponses>=0.7.3
aiosqlite~=0.17.0
aiotools~=1.7.0
Expand Down
5 changes: 3 additions & 2 deletions src/ai/backend/client/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"api_session",
)

from ..common.types import SSLContextType

api_session: ContextVar[BaseSession] = ContextVar("api_session")

Expand Down Expand Up @@ -408,7 +409,7 @@ def __init__(
self._worker_thread.start()

async def _create_aiohttp_session() -> aiohttp.ClientSession:
ssl = None
ssl: SSLContextType = None
if self._config.skip_sslcert_validation:
ssl = False
connector = aiohttp.TCPConnector(ssl=ssl)
Expand Down Expand Up @@ -479,7 +480,7 @@ def __init__(
proxy_mode: bool = False,
) -> None:
super().__init__(config=config, proxy_mode=proxy_mode)
ssl = None
ssl: SSLContextType = None
if self._config.skip_sslcert_validation:
ssl = False
connector = aiohttp.TCPConnector(ssl=ssl)
Expand Down
4 changes: 4 additions & 0 deletions src/ai/backend/common/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from decimal import Decimal
from ipaddress import ip_address, ip_network
from pathlib import PurePosixPath
from ssl import SSLContext
from typing import (
TYPE_CHECKING,
Any,
Expand All @@ -41,6 +42,7 @@
import redis.asyncio.sentinel
import trafaret as t
import typeguard
from aiohttp import Fingerprint
from redis.asyncio import Redis

from .exception import InvalidIpAddressValue
Expand Down Expand Up @@ -1181,6 +1183,8 @@ def as_trafaret(cls) -> t.Trafaret:
# States of the round-robin scheduler for each resource group and architecture.
RoundRobinStates: TypeAlias = dict[str, dict[str, RoundRobinState]]

SSLContextType: TypeAlias = Literal[False] | Fingerprint | SSLContext | None


class ModelServiceStatus(enum.Enum):
HEALTHY = "healthy"
Expand Down
3 changes: 2 additions & 1 deletion src/ai/backend/manager/container_registry/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from ai.backend.common.exception import InvalidImageName, InvalidImageTag
from ai.backend.common.logging import BraceStyleAdapter

from ...common.types import SSLContextType
from ..models.image import ImageRow, ImageType
from ..models.utils import ExtendedAsyncSAEngine

Expand Down Expand Up @@ -70,7 +71,7 @@ def __init__(

@actxmgr
async def prepare_client_session(self) -> AsyncIterator[tuple[yarl.URL, aiohttp.ClientSession]]:
ssl_ctx = None # default
ssl_ctx: SSLContextType = None # default
if not self.registry_info["ssl_verify"]:
ssl_ctx = False
connector = aiohttp.TCPConnector(ssl=ssl_ctx)
Expand Down
Loading