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

[Core] Add gRPC streaming support by moving to the async callback/reactor API. #15279

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/ray/core_worker/gcs_server_address_updater.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class GcsServerAddressUpdater {
/// Update gcs server address.
void UpdateGcsServerAddress();

rpc::ClientCallManager client_call_manager_;
/// A client connection to the raylet.
raylet::RayletClient raylet_client_;
std::function<void(std::string, int)> update_func_;
Expand Down
6 changes: 3 additions & 3 deletions src/ray/raylet/node_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -662,14 +662,14 @@ class NodeManager : public rpc::NodeManagerServiceHandler {
std::shared_ptr<AgentManager> agent_manager_;

/// The RPC server.
rpc::GrpcServer node_manager_server_;
rpc::GrpcCallbackServer node_manager_server_;

/// The node manager RPC service.
rpc::NodeManagerGrpcService node_manager_service_;
rpc::NodeManagerServiceWithCallbacks node_manager_service_;

/// The agent manager RPC service.
std::unique_ptr<rpc::AgentManagerServiceHandler> agent_manager_service_handler_;
rpc::AgentManagerGrpcService agent_manager_service_;
rpc::AgentManagerServiceWithCallbacks agent_manager_service_;

/// Manages all local objects that are pinned (primary
/// copies), freed, and/or spilled.
Expand Down
34 changes: 4 additions & 30 deletions src/ray/rpc/agent_manager/agent_manager_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,13 @@
#pragma once

#include "ray/common/asio/instrumented_io_context.h"
#include "ray/rpc/grpc_server.h"
#include "ray/rpc/server_call.h"
#include "ray/rpc/grpc_callback_server.h"
#include "src/ray/protobuf/agent_manager.grpc.pb.h"
#include "src/ray/protobuf/agent_manager.pb.h"

namespace ray {
namespace rpc {

#define RAY_AGENT_MANAGER_RPC_HANDLERS \
RPC_SERVICE_HANDLER(AgentManagerService, RegisterAgent, -1)

/// Implementations of the `AgentManagerGrpcService`, check interface in
/// `src/ray/protobuf/agent_manager.proto`.
class AgentManagerServiceHandler {
Expand All @@ -43,32 +39,10 @@ class AgentManagerServiceHandler {
SendReplyCallback send_reply_callback) = 0;
};

/// The `GrpcService` for `AgentManagerGrpcService`.
class AgentManagerGrpcService : public GrpcService {
public:
/// Construct a `AgentManagerGrpcService`.
///
/// \param[in] port See `GrpcService`.
/// \param[in] handler The service handler that actually handle the requests.
AgentManagerGrpcService(instrumented_io_context &io_service,
AgentManagerServiceHandler &service_handler)
: GrpcService(io_service), service_handler_(service_handler){};

protected:
grpc::Service &GetGrpcService() override { return service_; }

void InitServerCallFactories(
const std::unique_ptr<grpc::ServerCompletionQueue> &cq,
std::vector<std::unique_ptr<ServerCallFactory>> *server_call_factories) override {
RAY_AGENT_MANAGER_RPC_HANDLERS
}
#define RAY_AGENT_MANAGER_RPC_HANDLERS \
UNARY_CALLBACK_RPC_SERVICE_HANDLER(AgentManagerService, RegisterAgent)

private:
/// The grpc async service object.
AgentManagerService::AsyncService service_;
/// The service handler that actually handle the requests.
AgentManagerServiceHandler &service_handler_;
};
CALLBACK_SERVICE(AgentManagerService, RAY_AGENT_MANAGER_RPC_HANDLERS)

} // namespace rpc
} // namespace ray
Loading