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] Get node to connect for driver in global state accessor #16810

Merged
merged 16 commits into from
Jul 8, 2021

Conversation

kfstorm
Copy link
Member

@kfstorm kfstorm commented Jul 1, 2021

Why are these changes needed?

When a driver starts, it needs to figure out the node manager port, the Raylet socket file path, and the Plasma store socket file path to be able to connect to the local Raylet. (A worker doesn't need this step because the information is included in worker command-line arguments.) This step is required by all language bindings. Currently, the logic is implemented in Python, which makes it hard to be reused by Java and C++ bindings.

In this PR, we move this logic to C++ code (global state accessor) to make it shared by all language bindings.

This PR also removes the mandatory and hardcoded --node-manager-port 62665 parameter for ray start --head when users try the C++ API.

Related issue number

#16735

Checks

  • 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 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 :(

@wuisawesome
Copy link
Contributor

Can you provide an explanation about what this is and why we need it?

@kfstorm
Copy link
Member Author

kfstorm commented Jul 2, 2021

@wuisawesome Sorry I didn't add a description because it was too late last night. Please see the PR description.

boost::asio::ip::udp::resolver::iterator endpoints = resolver.resolve(query);
boost::asio::ip::udp::endpoint ep = *endpoints;
boost::asio::ip::udp::socket socket(netService);
socket.connect(ep);
Copy link
Contributor

Choose a reason for hiding this comment

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

We'd better use a timeout here, and handle failure.

Copy link
Member Author

Choose a reason for hiding this comment

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

The original Python code doesn't have a timeout either, and I already handled failure via try-catch.

@SongGuyang
Copy link
Contributor

Can you merge master and fix the conflicting files?

Copy link
Contributor

@SongGuyang SongGuyang left a comment

Choose a reason for hiding this comment

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

Overall good for me. Someone need to review the GCS part.

cpp/src/ray/util/process_helper.cc Show resolved Hide resolved
cpp/src/ray/util/process_helper.cc Show resolved Hide resolved
Copy link
Contributor

@WangTaoTheTonic WangTaoTheTonic left a comment

Choose a reason for hiding this comment

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

It doesn't add new function in GCS but only reuse existing get all nodes, LGTM with just a tiny comments.
Probably you need to remove the new line added in the end of some files. :-)

}
}

if (!status.IsNotFound()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This check can be removed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch!

@kfstorm
Copy link
Member Author

kfstorm commented Jul 8, 2021

//python/ray/serve:test_deploy failure on mac should be unrelated. It passed on Linux.

@kfstorm kfstorm merged commit e925051 into ray-project:master Jul 8, 2021
@kfstorm kfstorm deleted the get_node_to_connect_for_driver branch July 8, 2021 03:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants