Skip to content

Commit

Permalink
Revert "[core] Add source location to status" (#48517)
Browse files Browse the repository at this point in the history
Reverts #48458
  • Loading branch information
can-anyscale authored Nov 2, 2024
1 parent e162165 commit f6a5423
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 150 deletions.
20 changes: 1 addition & 19 deletions src/ray/common/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//bazel:ray.bzl", "ray_cc_library", "ray_cc_test")
load("//bazel:ray.bzl", "ray_cc_library")

ray_cc_library(
name = "constants",
Expand Down Expand Up @@ -268,23 +268,5 @@ ray_cc_library(
hdrs = ["status.h"],
deps = [
"//src/ray/util",
":source_location",
],
)

ray_cc_library(
name = "source_location",
srcs = ["source_location.cc"],
hdrs = ["source_location.h"],
)

ray_cc_test(
name = "source_location_test",
size = "small",
srcs = ["source_location_test.cc"],
tags = ["team:core"],
deps = [
":source_location",
"@com_google_googletest//:gtest_main",
],
)
28 changes: 0 additions & 28 deletions src/ray/common/source_location.cc

This file was deleted.

38 changes: 0 additions & 38 deletions src/ray/common/source_location.h

This file was deleted.

44 changes: 0 additions & 44 deletions src/ray/common/source_location_test.cc

This file was deleted.

21 changes: 3 additions & 18 deletions src/ray/common/status.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@

#include "ray/common/status.h"

#include <assert.h>

#include <boost/system/error_code.hpp>
#include <cassert>
#include <sstream>

#include "absl/container/flat_hash_map.h"

Expand Down Expand Up @@ -119,18 +119,11 @@ const absl::flat_hash_map<std::string, StatusCode> kStrToCode = []() {

} // namespace

Status::Status(StatusCode code, const std::string &msg, int rpc_code)
: Status(code, msg, SourceLocation{}, rpc_code) {}

Status::Status(StatusCode code,
const std::string &msg,
SourceLocation loc,
int rpc_code) {
Status::Status(StatusCode code, const std::string &msg, int rpc_code) {
assert(code != StatusCode::OK);
state_ = new State;
state_->code = code;
state_->msg = msg;
state_->loc = loc;
state_->rpc_code = rpc_code;
}

Expand Down Expand Up @@ -170,16 +163,8 @@ std::string Status::ToString() const {
if (state_ == nullptr) {
return result;
}

result += ": ";
result += state_->msg;

if (IsValidSourceLoc(state_->loc)) {
std::stringstream ss;
ss << state_->loc;
result += " at ";
result += ss.str();
}
return result;
}

Expand Down
3 changes: 0 additions & 3 deletions src/ray/common/status.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include <iosfwd>
#include <string>

#include "ray/common/source_location.h"
#include "ray/util/logging.h"
#include "ray/util/macros.h"
#include "ray/util/visibility.h"
Expand Down Expand Up @@ -125,7 +124,6 @@ class RAY_EXPORT Status {
~Status() { delete state_; }

Status(StatusCode code, const std::string &msg, int rpc_code = -1);
Status(StatusCode code, const std::string &msg, SourceLocation loc, int rpc_code = -1);

// Copy the specified status.
Status(const Status &s);
Expand Down Expand Up @@ -327,7 +325,6 @@ class RAY_EXPORT Status {
struct State {
StatusCode code;
std::string msg;
SourceLocation loc;
// If code is RpcError, this contains the RPC error code
int rpc_code;
};
Expand Down

0 comments on commit f6a5423

Please sign in to comment.