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 Autoscaler stub methods to GcsClients. #46061

Merged
merged 4 commits into from
Jun 20, 2024

Conversation

rynewang
Copy link
Contributor

@rynewang rynewang commented Jun 15, 2024

ray::rpc::autoscaler::AutoscalerStateService is on GCS, accessible via PythonGcsClient but not via GcsClient. This PR adds all methods and brings feature parity for the latter.

In order to add it to GcsRpcClient, we find 2 challenges:

  1. The service and its proto types are in namespace ray::rpc::autoscaler, not ray::rpc as all other services and methods.
  2. The reply protos has no status field like all other replies.

To support this, I changed VOID_GCS_RPC_CLIENT_METHOD to a more generic version VOID_GCS_RPC_CLIENT_METHOD_FULL that accepts a namespace and a boolean handle_payload_status. The boolean is passed to invoke_async_method in compile time. This allows us to only check status field if the bool is true, and don't check it for the new autoscaler methods.

The GcsClient methods are only added with sync version and not async version, because the callers only need sync ones.

Signed-off-by: Ruiyang Wang <rywang014@gmail.com>
@rynewang rynewang added the go add ONLY when ready to merge, run all tests label Jun 15, 2024
Signed-off-by: Ruiyang Wang <rywang014@gmail.com>
}, \
timeout_ms); \
return promise.get_future().get(); \
#define VOID_GCS_RPC_CLIENT_METHOD_FULL(NAMESPACE, \
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add some documentation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

Comment on lines +898 to +911
virtual Status RequestClusterResourceConstraint(
int64_t timeout_ms,
const std::vector<std::unordered_map<std::string, double>> &bundles,
const std::vector<int64_t> &count_array);

virtual Status GetClusterResourceState(int64_t timeout_ms,
std::string &serialized_reply);

virtual Status GetClusterStatus(int64_t timeout_ms, std::string &serialized_reply);

virtual Status ReportAutoscalingState(int64_t timeout_ms,
const std::string &serialized_state);

virtual Status DrainNode(const std::string &node_id,
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please add documentation?

request, &reply, timeout_ms);
}

Status AutoscalerStateAccessor::DrainNode(const std::string &node_id,
Copy link
Contributor

Choose a reason for hiding this comment

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

(Same for other methods) There are quite some code duplication with PythonGcsClient::DrainNode(). I know eventually we want to replace PythonGcsClient. But in the interim, is it possible to extract common code and invoke it from both? Wondering if we could avoid code diverging in the two places.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess we are deleting the PythonGcsClient ones really quick so it's not that beneficial to do common functions with 2 wrappers.

Signed-off-by: Ruiyang Wang <rywang014@gmail.com>
Copy link
Contributor

@jjyao jjyao left a comment

Choose a reason for hiding this comment

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

lg

src/ray/gcs/gcs_client/accessor.cc Outdated Show resolved Hide resolved
Signed-off-by: Ruiyang Wang <rywang014@gmail.com>
@jjyao jjyao merged commit 8cddf98 into ray-project:master Jun 20, 2024
6 checks passed
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.

None yet

3 participants