ray.serve.grpc_util.RayServegRPCContext#

class ray.serve.grpc_util.RayServegRPCContext(grpc_context: grpc._cython.cygrpc._ServicerContext)[source]#

Context manager to set and get gRPC context.

This class implements most of the methods from ServicerContext (see: https://grpc.github.io/grpc/python/grpc.html#grpc.ServicerContext). It’s serializable and can be passed with the request to be used on the deployment.

PublicAPI (beta): This API is in beta and may change before becoming stable.

Methods

auth_context

Gets the auth context for the call.

code

Accesses the value to be used as status code upon RPC completion.

details

Accesses the value to be used as detail string upon RPC completion.

invocation_metadata

Accesses the metadata sent by the client.

peer

Identifies the peer that invoked the RPC being serviced.

peer_identities

Gets one or more peer identity(s).

peer_identity_key

The auth property used to identify the peer.

set_code

Sets the value to be used as status code upon RPC completion.

set_compression

Set the compression algorithm to be used for the entire call.

set_details

Sets the value to be used as detail string upon RPC completion.

set_on_grpc_context

Serve's internal method to set attributes on the gRPC context.

set_trailing_metadata

Sets the trailing metadata for the RPC.