Repository navigation
Replace Actor Channel's pubsub with grpc - #16723
wuisawesome wants to merge 25 commits into
Conversation
|
|
||
| namespace pub_internal { | ||
|
|
||
| class SubscriptionIndexInterface { |
There was a problem hiding this comment.
These publisher changes could probably be pulled out into a separate PR, but they're pretty self-contained (makes the SubscriptionIndex follow the same pattern as the subscriber's SubscriberChannel to "properly" support templating.
There was a problem hiding this comment.
Makes sense. This is to put different templated index to the same dict right?
|
This isn't ready to merge yet, but most of the logic is here, and I think it would be good to get and some initial thoughts even before all the bugs are fixed up. |
|
Btw, can you add an unit test that checks if different type of IDs are working properly? (just one unit test to check if ObjectID and NodeID both are working with the subscriber / publisher) |
|
|
||
| namespace pub_internal { | ||
|
|
||
| class SubscriptionIndexInterface { |
There was a problem hiding this comment.
Makes sense. This is to put different templated index to the same dict right?
| gcs_address.set_ip_address(client_impl_->GetGcsServerAddress().first); | ||
| gcs_address.set_port(client_impl_->GetGcsServerAddress().second); | ||
| auto subscription_callback = [actor_id, subscribe](const rpc::PubMessage &message) { | ||
| RAY_LOG(ERROR) << "Got a subscription!"; |
| gcs_address, actor_id.Binary(), subscription_callback, | ||
| failure_callback); | ||
| return Status::OK(); | ||
| } else { |
There was a problem hiding this comment.
Can you un-indent the else block? That would avoid such a huge diff below which presumably hasn't changed. There's an early return above so it's not needed.
| return Status::UnknownError(msg.str()); | ||
| } | ||
|
|
||
| } else { |
| // command batch). | ||
| RAY_LOG(FATAL) | ||
| << "GCS seems to have died. We've lost our subscription to actor changes."; | ||
| } else { |
| << "Failed to get gcs server address when init gcs client."; | ||
| } | ||
| subscriber_ = std::make_unique<pubsub::Subscriber>( | ||
| subscriber_id_, /*TODO*/ 10, |
There was a problem hiding this comment.
Put the real variable name here instead of TODO
| // If there's no more subscription, do nothing. | ||
| if (subscription_it == subscription_map_.end()) { | ||
| for (const auto &pair : subscription_map_) { | ||
| RAY_LOG(ERROR) << "\t" << pair.first; |
| grpc_publisher_.RegisterSubscription(command.channel_type(), subscriber_id, | ||
| command.key_id()); | ||
| } else { | ||
| RAY_LOG(ERROR) << "Invalid command has received, " |
There was a problem hiding this comment.
Please change this to RAY_LOG(FATAL) and remove the GitHub message.
| "Github."; | ||
| std::stringstream stream; | ||
| stream << "Invalid pubsub command received: " << request.DebugString(); | ||
| status = Status::Invalid(stream.str()); |
|
|
||
| /// This implementation class of `PublisherHandler` | ||
| /// All non-handler public methods are threadsafe. | ||
| class GcsPublisherManager : public rpc::PublisherHandler { |
There was a problem hiding this comment.
Why not call it *Handler since it's just a rpc handler?
There was a problem hiding this comment.
I think the convention is Manager since I suppose it manages the lifecycle of the pubsub module? For example, GcsHeartbeatManager also doesn't really manage anything.
| /// The thread + io service the publisher runs on. | ||
| std::unique_ptr<std::thread> publisher_thread_; | ||
| instrumented_io_context &publisher_service_; | ||
| PeriodicalRunner periodical_runner_; |
There was a problem hiding this comment.
We don't seem to ever use this member
Why are these changes needed?
This PR removes the usage of the redis actor pubsub channel with the grpc based pubsub.
It should also be more efficient because we should no longer be broadcasting every actor change to every node. Instead nodes should only receive updates from relevant actors.
Related issue number
Checks
scripts/format.shto lint the changes in this PR.