Skip to content

Commit

Permalink
[core] Minor improvement for session (ray-project#48711)
Browse files Browse the repository at this point in the history
Some minor improvements for session implementation.

Signed-off-by: dentiny <dentinyhao@gmail.com>
  • Loading branch information
dentiny authored Nov 13, 2024
1 parent df15c58 commit e393a71
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/ray/raylet/runtime_env_agent_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Session : public std::enable_shared_from_this<Session> {
//
// This method should only be called once.
void run(FinishedCallback finished_callback) {
finished_callback_ = finished_callback;
finished_callback_ = std::move(finished_callback);
// Starts the state machine by looking up the domain name.
resolver_.async_resolve(
host_,
Expand Down Expand Up @@ -151,7 +151,7 @@ class Session : public std::enable_shared_from_this<Session> {

void on_connect(beast::error_code ec, tcp::resolver::results_type::endpoint_type) {
if (ec) {
Failed(ray::Status::NotFound("on_connect " + ec.message()));
Failed(ray::Status::NotFound(absl::StrCat("on_connect ", ec.message())));
return;
}

Expand All @@ -163,9 +163,8 @@ class Session : public std::enable_shared_from_this<Session> {

void on_write(beast::error_code ec, std::size_t bytes_transferred) {
if (ec) {
Failed(ray::Status::Disconnected("on_write " + ec.message() +
", bytes_transferred " +
std::to_string(bytes_transferred)));
Failed(ray::Status::Disconnected(absl::StrCat(
"on_write ", ec.message(), ", bytes_transferred ", bytes_transferred)));
return;
}
stream_.expires_never();
Expand All @@ -178,9 +177,8 @@ class Session : public std::enable_shared_from_this<Session> {

void on_read(beast::error_code ec, std::size_t bytes_transferred) {
if (ec) {
Failed(ray::Status::Disconnected("on_read " + ec.message() +
", bytes_transferred " +
std::to_string(bytes_transferred)));
Failed(ray::Status::Disconnected(absl::StrCat(
"on_read ", ec.message(), ", bytes_transferred ", bytes_transferred)));
return;
}

Expand Down Expand Up @@ -276,7 +274,7 @@ class HttpRuntimeEnvAgentClient : public RuntimeEnvAgentClient {
: io_context_(io_context),
session_pool_(session_pool_size),
address_(address),
port_str_(std::to_string(port)),
port_str_(absl::StrFormat("%d", port)),
delay_executor_(delay_executor),
shutdown_raylet_gracefully_(shutdown_raylet_gracefully),
agent_register_timeout_ms_(agent_register_timeout_ms),
Expand Down

0 comments on commit e393a71

Please sign in to comment.