Skip to content

[core] Use core worker client pool in GCS#53654

Merged
jjyao merged 4 commits intoray-project:masterfrom
dayshah:gcs-worker-pool
Jun 21, 2025
Merged

[core] Use core worker client pool in GCS#53654
jjyao merged 4 commits intoray-project:masterfrom
dayshah:gcs-worker-pool

Conversation

@dayshah
Copy link
Copy Markdown
Contributor

@dayshah dayshah commented Jun 9, 2025

Why are these changes needed?

Replacing all uses of a core worker client factory / unshared client pool with a shared core worker client pool for the whole gcs server. This is needed to use the retryable grpc client in the gcs. Will be implementing retries for rpc's that exist and new gcs -> worker rpc's will need retries, ex. #51653

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: dayshah <dhyey2019@gmail.com>
Copilot AI review requested due to automatic review settings June 9, 2025 04:44
@dayshah dayshah added the go add ONLY when ready to merge, run all tests label Jun 9, 2025
@dayshah dayshah requested a review from a team as a code owner June 9, 2025 04:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the GCS components to replace the per‐call core worker client factory with a shared core worker client pool, enabling the use of retryable gRPC clients for interactions between GCS and workers. Key changes include:

  • Replacing all client_factory usages with a shared worker_client_pool across tests and production code.
  • Updating GCS server components (job manager, actor scheduler, actor manager, etc.) to use the new worker_client_pool API.
  • Adjusting test cases in various modules to work with the shared pool.

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/ray/gcs/gcs_server/test/gcs_job_manager_test.cc Updated to use worker_client_pool_ instead of client_factory.
src/ray/gcs/gcs_server/test/gcs_actor_scheduler_test.cc Modified to instantiate and use worker_client_pool_ accordingly.
src/ray/gcs/gcs_server/test/gcs_actor_scheduler_mock_test.cc Refactored to inject worker_client_pool_ in place of direct client creation.
src/ray/gcs/gcs_server/test/gcs_actor_manager_test.cc Updated to use worker_client_pool_ for actor manager tests.
src/ray/gcs/gcs_server/test/export_api/gcs_actor_manager_export_event_test.cc Modified to use worker_client_pool_ in export event tests.
src/ray/gcs/gcs_server/gcs_worker_manager.cc Replaced uses of a temporary client_factory with appropriate worker_client_pool_ calls.
src/ray/gcs/gcs_server/gcs_server.h Added include and member for the core worker client pool.
src/ray/gcs/gcs_server/gcs_server.cc Refactored worker pool initialization and its usage in job and actor managers.
src/ray/gcs/gcs_server/gcs_job_manager.h & .cc Updated constructor and calls to use the worker_client_pool.
src/ray/gcs/gcs_server/gcs_actor_scheduler.h & .cc Replaced core_worker_client factory usage with the shared worker_client_pool_.
src/ray/gcs/gcs_server/gcs_actor_manager.h & .cc Revised parameters and calls to use worker_client_pool_ for actor communication.
Comments suppressed due to low confidence (1)

src/ray/gcs/gcs_server/gcs_job_manager.cc:370

  • Previously a disconnect call was made when a job was marked dead. Verify that omitting worker_client_pool_.Disconnect(worker_id) here is intentional and that stale connections are properly handled elsewhere.
reply->mutable_job_info_list(jj)->set_is_running_tasks(false);

@edoakes
Copy link
Copy Markdown
Collaborator

edoakes commented Jun 9, 2025

Signed-off-by: dayshah <dhyey2019@gmail.com>
@dayshah dayshah requested a review from israbbani June 9, 2025 22:13
Copy link
Copy Markdown
Contributor

@israbbani israbbani left a comment

Choose a reason for hiding this comment

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

🚢

@jjyao
Copy link
Copy Markdown
Contributor

jjyao commented Jun 10, 2025

How do we GC clients inside the pool?

[this](const std::shared_ptr<rpc::WorkerTableData> &worker_failure_data) {
auto &worker_address = worker_failure_data->worker_address();
auto worker_id = WorkerID::FromBinary(worker_address.worker_id());
worker_client_pool_.Disconnect(worker_id);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@jjyao cleaning up here on dead worker

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We also need it when the node dies, since if node dies, we won't call this listener for each individual worker on the node.

Copy link
Copy Markdown
Contributor Author

@dayshah dayshah Jun 10, 2025

Choose a reason for hiding this comment

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

oh I expected the worker death to be propagated there in case of node death too.

Anyways updated to disconnect on node death too

dayshah added 2 commits June 10, 2025 10:10
Signed-off-by: dayshah <dhyey2019@gmail.com>
Signed-off-by: dayshah <dhyey2019@gmail.com>
@dayshah dayshah requested review from edoakes and jjyao June 10, 2025 17:12
@jjyao jjyao merged commit b1f3841 into ray-project:master Jun 21, 2025
5 checks passed
@dayshah dayshah deleted the gcs-worker-pool branch June 21, 2025 05:58
minerharry pushed a commit to minerharry/ray that referenced this pull request Jun 27, 2025
Signed-off-by: dayshah <dhyey2019@gmail.com>
elliot-barn pushed a commit that referenced this pull request Jul 2, 2025
Signed-off-by: dayshah <dhyey2019@gmail.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
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.

5 participants