Skip to content

Commit

Permalink
[serve] Remove unused "endpoint" field of RequestMetadata (#48451)
Browse files Browse the repository at this point in the history
Some vestigial field that is no longer used...

---------

Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
  • Loading branch information
edoakes authored Oct 31, 2024
1 parent 77fcedf commit d582be5
Show file tree
Hide file tree
Showing 13 changed files with 1 addition and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ public DeploymentResponse remote(Object... parameters) {
RayServeMetrics.execute(() -> requestCounter.inc(1.0));
RequestMetadata.Builder requestMetadata = RequestMetadata.newBuilder();
requestMetadata.setRequestId(requestContext.getRequestId());
requestMetadata.setEndpoint(deploymentId.getName());
requestMetadata.setCallMethod(
handleOptions != null ? handleOptions.getMethodName() : Constants.CALL_METHOD);
requestMetadata.setRoute(requestContext.getRoute());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@ public void parseRequestMetadataTest() {
RequestMetadata.newBuilder()
.setRequestId(requestId)
.setCallMethod(callMethod)
.setEndpoint(endpoint)
.putContext("context", context)
.build();

RequestMetadata result = ServeProtoUtil.parseRequestMetadata(requestMetadata.toByteArray());
Assert.assertNotNull(result);
Assert.assertEquals(result.getCallMethod(), callMethod);
Assert.assertEquals(result.getEndpoint(), endpoint);
Assert.assertEquals(result.getRequestId(), requestId);
Assert.assertEquals(result.getContextMap().get("context"), context);
}
Expand Down
1 change: 0 additions & 1 deletion python/ray/serve/_private/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,6 @@ class RequestMetadata:
# internal_request_id is always generated by the proxy and is used for tracking
# request objects. We can assume this is always unique between requests.
internal_request_id: str
endpoint: str
call_method: str = "__call__"

# HTTP route path of the request.
Expand Down
1 change: 0 additions & 1 deletion python/ray/serve/_private/replica.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,6 @@ async def handle_request_from_java(
request_metadata: RequestMetadata = RequestMetadata(
request_id=proto.request_id,
internal_request_id=proto.internal_request_id,
endpoint=proto.endpoint,
call_method=proto.call_method,
multiplexed_model_id=proto.multiplexed_model_id,
route=proto.route,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ def _send_request_java(self, pr: PendingRequest) -> ObjectRef:
return self._actor_handle.handle_request.remote(
RequestMetadataProto(
request_id=pr.metadata.request_id,
endpoint=pr.metadata.endpoint,
# Default call method in java is "call," not "__call__" like Python.
call_method="call"
if pr.metadata.call_method == "__call__"
Expand Down
1 change: 0 additions & 1 deletion python/ray/serve/handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ def _remote(
internal_request_id=_request_context._internal_request_id
if _request_context._internal_request_id
else generate_request_id(),
endpoint=self.deployment_name,
call_method=self.handle_options.method_name,
route=_request_context.route,
app_name=self.app_name,
Expand Down
3 changes: 0 additions & 3 deletions python/ray/serve/tests/test_actor_replica_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ async def test_send_request(setup_fake_replica, is_streaming: bool):
metadata=RequestMetadata(
request_id="abc",
internal_request_id="def",
endpoint="123",
is_streaming=is_streaming,
),
)
Expand Down Expand Up @@ -149,7 +148,6 @@ async def test_send_request_with_rejection(
metadata=RequestMetadata(
request_id="abc",
internal_request_id="def",
endpoint="123",
is_streaming=is_streaming,
),
)
Expand Down Expand Up @@ -187,7 +185,6 @@ async def test_send_request_with_rejection_cancellation(setup_fake_replica):
metadata=RequestMetadata(
request_id="abc",
internal_request_id="def",
endpoint="123",
),
)

Expand Down
2 changes: 0 additions & 2 deletions python/ray/serve/tests/unit/test_pow_2_replica_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ def fake_pending_request(
metadata=RequestMetadata(
request_id=str(uuid.uuid4()),
internal_request_id=str(uuid.uuid4()),
endpoint="endpoint",
multiplexed_model_id=model_id,
),
created_at=created_at,
Expand All @@ -199,7 +198,6 @@ def fake_pending_request(
metadata=RequestMetadata(
request_id=str(uuid.uuid4()),
internal_request_id=str(uuid.uuid4()),
endpoint="endpoint",
multiplexed_model_id=model_id,
),
)
Expand Down
1 change: 0 additions & 1 deletion python/ray/serve/tests/unit/test_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,6 @@ async def test_receive_asgi_messages(self):
request_metadata = RequestMetadata(
request_id="fake-request-id",
internal_request_id="fake-internal-request-id",
endpoint="fake-endpoint",
)
queue = AsyncMock()
http_proxy.asgi_receive_queues[internal_request_id] = queue
Expand Down
3 changes: 0 additions & 3 deletions python/ray/serve/tests/unit/test_request_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,13 @@ def test_request_metadata():
"""
request_id = "request-id"
internal_request_id = "internal-request-id"
endpoint = "endpoint"
request_metadata = RequestMetadata(
request_id=request_id,
internal_request_id=internal_request_id,
endpoint=endpoint,
)

# Ensure the default values are set correctly.
assert request_metadata.request_id == request_id
assert request_metadata.endpoint == endpoint
assert request_metadata.call_method == "__call__"
assert request_metadata.route == ""
assert request_metadata.app_name == ""
Expand Down
8 changes: 0 additions & 8 deletions python/ray/serve/tests/unit/test_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ def dummy_request_metadata(is_streaming: bool = False) -> RequestMetadata:
return RequestMetadata(
request_id="test-request-1",
internal_request_id="test-internal-request-1",
endpoint="",
is_streaming=is_streaming,
)

Expand All @@ -241,7 +240,6 @@ async def test_basic(
request_metadata = RequestMetadata(
request_id="test-request-1",
internal_request_id="test-internal-request-1",
endpoint="",
is_streaming=is_streaming,
)
replica_result = await router.assign_request(request_metadata)
Expand Down Expand Up @@ -286,7 +284,6 @@ async def test_basic_with_rejection(
request_metadata = RequestMetadata(
request_id="test-request-1",
internal_request_id="test-internal-request-1",
endpoint="",
is_streaming=is_streaming,
)
replica_result = await router.assign_request(request_metadata)
Expand Down Expand Up @@ -341,7 +338,6 @@ async def test_retry_with_rejection(
request_metadata = RequestMetadata(
request_id="test-request-1",
internal_request_id="test-internal-request-1",
endpoint="",
is_streaming=is_streaming,
)
replica_result = await router.assign_request(request_metadata)
Expand Down Expand Up @@ -371,7 +367,6 @@ async def test_cross_lang_no_rejection(
request_metadata = RequestMetadata(
request_id="test-request-1",
internal_request_id="test-internal-request-1",
endpoint="",
)
replica_result = await router.assign_request(request_metadata)
assert not replica_result._is_generator_object
Expand All @@ -393,7 +388,6 @@ async def test_max_queued_requests_no_limit(
request_metadata = RequestMetadata(
request_id="test-request-1",
internal_request_id="test-internal-request-1",
endpoint="",
)

# Queued a bunch of tasks. None should error because there's no limit.
Expand Down Expand Up @@ -431,7 +425,6 @@ async def test_max_queued_requests_limited(
request_metadata = RequestMetadata(
request_id="test-request-1",
internal_request_id="test-internal-request-1",
endpoint="",
)

# Queued `max_queued_requests` tasks. None should fail.
Expand Down Expand Up @@ -490,7 +483,6 @@ async def test_max_queued_requests_updated(
request_metadata = RequestMetadata(
request_id="test-request-1",
internal_request_id="test-internal-request-1",
endpoint="",
)

# Queued `max_queued_requests` tasks. None should fail.
Expand Down
1 change: 0 additions & 1 deletion python/ray/serve/tests/unit/test_user_callable_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ def _make_request_metadata(
return RequestMetadata(
request_id="test_request",
internal_request_id="test_internal_request",
endpoint="test_endpoint",
call_method=call_method if call_method is not None else "__call__",
_request_protocol=protocol,
is_streaming=is_streaming,
Expand Down
4 changes: 1 addition & 3 deletions src/ray/protobuf/serve.proto
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ enum DeploymentLanguage {
message RequestMetadata {
string request_id = 1;

string endpoint = 2;
string internal_request_id = 2;

string call_method = 3;

Expand All @@ -154,8 +154,6 @@ message RequestMetadata {
string multiplexed_model_id = 5;

string route = 6;

string internal_request_id = 7;
}

message RequestWrapper {
Expand Down

0 comments on commit d582be5

Please sign in to comment.