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

[serve] Remove aiorwlock dependency #42159

Merged
merged 10 commits into from
Jan 10, 2024
33 changes: 14 additions & 19 deletions python/ray/serve/_private/replica.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from importlib import import_module
from typing import Any, AsyncGenerator, Callable, Dict, Optional, Tuple, Union

import aiorwlock
import starlette.responses
from starlette.requests import Request
from starlette.types import Message, Receive, Scope, Send
Expand Down Expand Up @@ -590,7 +589,6 @@ def __init__(
self._is_function = inspect.isfunction(deployment_def)
self._deployment_id = deployment_id
self._replica_tag = replica_tag
self._rwlock = aiorwlock.RWLock()
self._delete_lock = asyncio.Lock()

# Will be populated in `initialize_callable`.
Expand Down Expand Up @@ -785,24 +783,21 @@ async def call_user_health_check(self):
await self._user_health_check()

async def call_reconfigure(self, user_config: Any):
async with self._rwlock.writer:
if user_config is not None:
if self._is_function:
raise ValueError(
"deployment_def must be a class to use user_config"
)
elif not hasattr(self._callable, RECONFIGURE_METHOD):
raise RayServeException(
"user_config specified but deployment "
+ self._deployment_id
+ " missing "
+ RECONFIGURE_METHOD
+ " method"
)
reconfigure_method = sync_to_async(
getattr(self._callable, RECONFIGURE_METHOD)
if user_config is not None:
edoakes marked this conversation as resolved.
Show resolved Hide resolved
if self._is_function:
raise ValueError("deployment_def must be a class to use user_config")
elif not hasattr(self._callable, RECONFIGURE_METHOD):
raise RayServeException(
"user_config specified but deployment "
+ self._deployment_id
+ " missing "
+ RECONFIGURE_METHOD
+ " method"
)
await reconfigure_method(user_config)
reconfigure_method = sync_to_async(
getattr(self._callable, RECONFIGURE_METHOD)
)
await reconfigure_method(user_config)

async def call_user_method(
self,
Expand Down
1 change: 0 additions & 1 deletion python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ def get_packages(self):
"requests",
"starlette",
"fastapi",
"aiorwlock",
"watchfiles",
],
"tune": ["pandas", "tensorboardX>=1.9", "requests", pyarrow_dep, "fsspec"],
Expand Down
Loading