forked from ray-project/ray
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[1/N] add virtual cluster grpc service and handler (#410)
Co-authored-by: 黑驰 <[email protected]>
- Loading branch information
Showing
8 changed files
with
275 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright 2017 The Ray Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "ray/gcs/gcs_server/gcs_server.h" | ||
|
||
#include "ray/gcs/gcs_server/gcs_virtual_cluster_manager.h" | ||
|
||
namespace ray { | ||
namespace gcs { | ||
void GcsServer::InitGcsVirtualClusterManager(const GcsInitData &gcs_init_data) { | ||
RAY_CHECK(gcs_table_storage_ && gcs_publisher_); | ||
gcs_virtual_cluster_manager_ = std::make_shared<gcs::GcsVirtualClusterManager>(); | ||
// Initialize by gcs tables data. | ||
gcs_virtual_cluster_manager_->Initialize(gcs_init_data); | ||
// Register service. | ||
gcs_virtual_cluster_service_.reset(new rpc::VirtualClusterInfoGrpcService( | ||
io_context_provider_.GetDefaultIOContext(), *gcs_virtual_cluster_manager_)); | ||
rpc_server_.RegisterService(*gcs_virtual_cluster_service_); | ||
} | ||
} // namespace gcs | ||
} // namespace ray |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright 2017 The Ray Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "ray/gcs/gcs_server/gcs_virtual_cluster_manager.h" | ||
|
||
namespace ray { | ||
namespace gcs { | ||
|
||
void GcsVirtualClusterManager::Initialize(const GcsInitData &gcs_init_data) { | ||
// TODO(Shanly): To be implement. | ||
} | ||
|
||
void GcsVirtualClusterManager::HandleCreateOrUpdateVirtualCluster( | ||
rpc::CreateOrUpdateVirtualClusterRequest request, | ||
rpc::CreateOrUpdateVirtualClusterReply *reply, | ||
rpc::SendReplyCallback send_reply_callback) { | ||
const auto &virtual_cluster_id = request.virtual_cluster_id(); | ||
RAY_LOG(INFO) << "Start creating or updating virtual cluster " << virtual_cluster_id; | ||
// TODO(Shanly): To be implement. | ||
} | ||
|
||
void GcsVirtualClusterManager::HandleRemoveVirtualCluster( | ||
rpc::RemoveVirtualClusterRequest request, | ||
rpc::RemoveVirtualClusterReply *reply, | ||
rpc::SendReplyCallback send_reply_callback) { | ||
const auto &virtual_cluster_id = request.virtual_cluster_id(); | ||
RAY_LOG(INFO) << "Start removing virtual cluster " << virtual_cluster_id; | ||
// TODO(Shanly): To be implement. | ||
} | ||
|
||
void GcsVirtualClusterManager::HandleGetAllVirtualClusters( | ||
rpc::GetAllVirtualClustersRequest request, | ||
rpc::GetAllVirtualClustersReply *reply, | ||
rpc::SendReplyCallback send_reply_callback) { | ||
RAY_LOG(DEBUG) << "Getting all virtual clusters."; | ||
// TODO(Shanly): To be implement. | ||
} | ||
|
||
} // namespace gcs | ||
} // namespace ray |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright 2017 The Ray Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#pragma once | ||
|
||
#include "ray/gcs/gcs_server/gcs_init_data.h" | ||
#include "ray/rpc/gcs_server/gcs_rpc_server.h" | ||
|
||
namespace ray { | ||
namespace gcs { | ||
|
||
/// This implementation class of `VirtualClusterInfoHandler`. | ||
class GcsVirtualClusterManager : public rpc::VirtualClusterInfoHandler { | ||
public: | ||
/// Initialize with the gcs tables data synchronously. | ||
/// This should be called when GCS server restarts after a failure. | ||
/// | ||
/// \param gcs_init_data. | ||
void Initialize(const GcsInitData &gcs_init_data); | ||
|
||
protected: | ||
void HandleCreateOrUpdateVirtualCluster( | ||
rpc::CreateOrUpdateVirtualClusterRequest request, | ||
rpc::CreateOrUpdateVirtualClusterReply *reply, | ||
rpc::SendReplyCallback send_reply_callback) override; | ||
|
||
void HandleRemoveVirtualCluster(rpc::RemoveVirtualClusterRequest request, | ||
rpc::RemoveVirtualClusterReply *reply, | ||
rpc::SendReplyCallback send_reply_callback) override; | ||
|
||
void HandleGetAllVirtualClusters(rpc::GetAllVirtualClustersRequest request, | ||
rpc::GetAllVirtualClustersReply *reply, | ||
rpc::SendReplyCallback send_reply_callback) override; | ||
}; | ||
|
||
} // namespace gcs | ||
} // namespace ray |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters