Skip to content

[Serve] [3/n] Add ClientStreaming and BidiStreaming RPCs to proto definitions#60769

Merged
abrarsheikh merged 11 commits intomasterfrom
abrar-grpc-bidir-pr3
Feb 10, 2026
Merged

[Serve] [3/n] Add ClientStreaming and BidiStreaming RPCs to proto definitions#60769
abrarsheikh merged 11 commits intomasterfrom
abrar-grpc-bidir-pr3

Conversation

@abrarsheikh
Copy link
Copy Markdown
Contributor

No description provided.

This PR adds the foundational types needed for gRPC client streaming
and bidirectional streaming support:

- gRPCStreamingType enum: Represents the four gRPC streaming types
  (UNARY_UNARY, UNARY_STREAM, STREAM_UNARY, STREAM_STREAM)
- gRPCStreamingRequest dataclass: Carries metadata about streaming
  sessions from proxy to replicas
- gRPCInputStream class: Public API for deployments to iterate over
  incoming request messages in client/bidirectional streaming RPCs

This is PR 1 of N for adding gRPC bidirectional streaming support.

Signed-off-by: abrar <abrar@anyscale.com>
This PR refactors the gRPC server's service handler factory to use the
new gRPCStreamingType enum instead of a boolean stream parameter.

Changes:
- Update gRPCGenericServer.add_generic_rpc_handlers() to register all
  four streaming handler types (unary_unary, unary_stream, stream_unary,
  stream_stream) using gRPCStreamingType enum
- Update unit tests to verify all four handler types are registered

This is PR 2 of N for adding gRPC bidirectional streaming support.

Signed-off-by: abrar <abrar@anyscale.com>
This PR adds the proto definitions for client streaming and bidirectional
streaming RPCs:

- Add ClientStreaming (stream-unary) RPC to UserDefinedService
- Add BidiStreaming (stream-stream) RPC to UserDefinedService
- Regenerate Python protobuf files for documentation examples

This is PR 3 of N for adding gRPC bidirectional streaming support.

Signed-off-by: abrar <abrar@anyscale.com>
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for client-side and bidirectional gRPC streaming to Ray Serve, which is a valuable feature enhancement. The changes are well-structured, including updates to protobuf definitions, the introduction of a gRPCStreamingType enum for clarity, and a new gRPCInputStream public API for handling streaming requests. The internal logic, tests, and documentation have been updated accordingly. The implementation appears solid, and the new APIs are well-designed. I have one minor suggestion to improve an example in a docstring to avoid potential user confusion.

async def ClientStreaming(self, request_stream: gRPCInputStream):
total = 0
async for request in request_stream:
total += request.value
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The example code in the docstring uses request.value, but the UserDefinedMessage protobuf message typically used in examples doesn't have a value field. It has name, origin, and num. To make the example clearer and more consistent with other examples, please use an actual field from the message, like request.num.

Suggested change
total += request.value
total += request.num

@abrarsheikh abrarsheikh added the go add ONLY when ready to merge, run all tests label Feb 5, 2026
Base automatically changed from abrar-grpc-bidir-pr2 to master February 9, 2026 18:24
@abrarsheikh abrarsheikh marked this pull request as ready for review February 9, 2026 22:42
@abrarsheikh abrarsheikh requested a review from a team as a code owner February 9, 2026 22:42
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

rpc Multiplexing(UserDefinedMessage2) returns (UserDefinedResponse2);
rpc Streaming(UserDefinedMessage) returns (stream UserDefinedResponse);
rpc ClientStreaming(stream UserDefinedMessage) returns (UserDefinedResponse);
rpc BidiStreaming(stream UserDefinedMessage) returns (stream UserDefinedResponse);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proto file modified, requires fault-tolerance review

Low Severity

⚠️ This PR modifies one or more .proto files.
Please review the RPC fault-tolerance & idempotency standards guide here:
https://github.com/ray-project/ray/tree/master/doc/source/ray-core/internals/rpc-fault-tolerance.rst

This violates the "RPC Fault Tolerance Standards Guide" rule requiring this message whenever .proto files are changed.

Additional Locations (1)

Fix in Cursor Fix in Web

rpc Multiplexing(UserDefinedMessage2) returns (UserDefinedResponse2);
rpc Streaming(UserDefinedMessage) returns (stream UserDefinedResponse);
rpc ClientStreaming(stream UserDefinedMessage) returns (UserDefinedResponse);
rpc BidiStreaming(stream UserDefinedMessage) returns (stream UserDefinedResponse);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR lacks description explaining changes

Low Severity

⚠️ This PR needs a clearer title and/or description.

To help reviewers, please ensure your PR includes:

  • Title: A concise summary of the change
  • Description:
    • What problem does this solve?
    • How does this PR solve it?
    • Any relevant context for reviewers such as:
      • Why is the problem important to solve?
      • Why was this approach chosen over others?

See this list of PRs as examples for PRs that have gone above and beyond:

This violates the "Clear PR Descriptions and Titles" rule because the description is "No description provided."

Fix in Cursor Fix in Web

@abrarsheikh abrarsheikh merged commit e6468f0 into master Feb 10, 2026
5 of 6 checks passed
@abrarsheikh abrarsheikh deleted the abrar-grpc-bidir-pr3 branch February 10, 2026 04:59
preneond pushed a commit to preneond/ray that referenced this pull request Feb 15, 2026
…initions (ray-project#60769)

Signed-off-by: abrar <abrar@anyscale.com>
Signed-off-by: Ondrej Prenek <ondra.prenek@gmail.com>
limarkdcunha pushed a commit to limarkdcunha/ray that referenced this pull request Feb 17, 2026
MuhammadSaif700 pushed a commit to MuhammadSaif700/ray that referenced this pull request Feb 17, 2026
…initions (ray-project#60769)

Signed-off-by: abrar <abrar@anyscale.com>
Signed-off-by: Muhammad Saif <2024BBIT200@student.Uet.edu.pk>
Kunchd pushed a commit to Kunchd/ray that referenced this pull request Feb 17, 2026
ans9868 pushed a commit to ans9868/ray that referenced this pull request Feb 18, 2026
…initions (ray-project#60769)

Signed-off-by: abrar <abrar@anyscale.com>
Signed-off-by: Adel Nour <ans9868@nyu.edu>
Aydin-ab pushed a commit to kunling-anyscale/ray that referenced this pull request Feb 20, 2026
peterxcli pushed a commit to peterxcli/ray that referenced this pull request Feb 25, 2026
…initions (ray-project#60769)

Signed-off-by: abrar <abrar@anyscale.com>
Signed-off-by: peterxcli <peterxcli@gmail.com>
peterxcli pushed a commit to peterxcli/ray that referenced this pull request Feb 25, 2026
…initions (ray-project#60769)

Signed-off-by: abrar <abrar@anyscale.com>
Signed-off-by: peterxcli <peterxcli@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants