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] No RAY_LOG in the constructor of DelayManager #26958

Merged
merged 1 commit into from
Jul 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions src/ray/common/asio/asio_chaos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "absl/strings/numbers.h"
#include "absl/strings/str_split.h"
#include "ray/common/ray_config.h"
#include "ray/util/logging.h"

namespace ray {
namespace asio {
Expand Down Expand Up @@ -65,7 +64,7 @@ class DelayManager {
if (delay_env.empty()) {
return;
}
RAY_LOG(ERROR) << "RAY_testing_asio_delay_us is set to " << delay_env;
std::cerr << "RAY_testing_asio_delay_us is set to " << delay_env << std::endl;
std::vector<std::string_view> items = absl::StrSplit(delay_env, ",");
for (const auto &item : items) {
ParseItem(item);
Expand All @@ -77,8 +76,9 @@ class DelayManager {
void ParseItem(std::string_view val) {
std::vector<std::string_view> item_val = absl::StrSplit(val, "=");
if (item_val.size() != 2) {
RAY_LOG(FATAL) << "Error in syntax: " << val
<< ", expected method=min_us:max:ms. Skip this entry.";
std::cerr << "Error in syntax: " << val
<< ", expected method=min_us:max:ms. Skip this entry." << std::endl;
_Exit(1);
}
auto delay_us = ParseVal(item_val[1]);
if (item_val[0] == "*") {
Expand All @@ -91,18 +91,21 @@ class DelayManager {
std::pair<int64_t, int64_t> ParseVal(std::string_view val) {
std::vector<std::string_view> delay_str_us = absl::StrSplit(val, ":");
if (delay_str_us.size() != 2) {
RAY_LOG(FATAL) << "Error in syntax: " << val
<< ", expected method=min_us:max:ms. Skip this entry";
std::cerr << "Error in syntax: " << val
<< ", expected method=min_us:max:ms. Skip this entry" << std::endl;
_Exit(1);
}
std::pair<int64_t, int64_t> delay_us;
if (!absl::SimpleAtoi(delay_str_us[0], &delay_us.first) ||
!absl::SimpleAtoi(delay_str_us[1], &delay_us.second)) {
RAY_LOG(FATAL) << "Error in syntax: " << val
<< ", expected method=min_us:max:ms. Skip this entry";
std::cerr << "Error in syntax: " << val
<< ", expected method=min_us:max:ms. Skip this entry" << std::endl;
_Exit(1);
}
if (delay_us.first > delay_us.second) {
RAY_LOG(FATAL) << delay_us.first << " is bigger than " << delay_us.second
<< ". Skip this entry.";
std::cerr << delay_us.first << " is bigger than " << delay_us.second
<< ". Skip this entry." << std::endl;
_Exit(1);
}
return delay_us;
}
Expand Down
5 changes: 5 additions & 0 deletions src/ray/common/test/asio_defer_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,8 @@ TEST(AsioChaosTest, WithGlobal) {
ASSERT_TRUE(EnsureBelow("method2", 20, 30));
ASSERT_TRUE(EnsureBelow("others", 100, 200));
}

int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}