Skip to content

Commit ac1b040

Browse files
committed
Move _get_request_router to PR 4 and make private
This method is consumed by the ingress routing logic in this PR, not by the base substrate PR. Renamed to private with TODO to migrate to DeploymentHandle.choose_replica() once ray-project#60865 lands. Signed-off-by: Seiji Eicher <seiji@anyscale.com>
1 parent 3c4d42e commit ac1b040

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

python/ray/llm/_internal/serve/core/ingress/ingress.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ async def _pick_routed_direct_ingress_endpoint(
617617
if handle is None:
618618
raise RuntimeError(f"No handle for model {model_id}")
619619

620-
request_router = handle.get_request_router()
620+
request_router = handle._get_request_router()
621621
if request_router is None:
622622
raise RuntimeError(f"Request router not initialized for {model_id}")
623623

python/ray/serve/handle.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,6 +1079,22 @@ def options(
10791079
response_serialization=response_serialization,
10801080
)
10811081

1082+
def _get_request_router(
1083+
self,
1084+
) -> Optional["ray.serve._private.request_router.request_router.RequestRouter"]:
1085+
"""Temporary: expose the request router for direct-ingress routing.
1086+
1087+
TODO: Replace with DeploymentHandle.choose_replica() once #60865 lands.
1088+
"""
1089+
if self._router is None:
1090+
return None
1091+
1092+
asyncio_router = getattr(self._router, "_asyncio_router", None)
1093+
if asyncio_router is not None:
1094+
return asyncio_router.request_router
1095+
1096+
return getattr(self._router, "request_router", None)
1097+
10821098
def remote(
10831099
self, *args, **kwargs
10841100
) -> Union[DeploymentResponse[Any], DeploymentResponseGenerator[Any]]:

0 commit comments

Comments
 (0)