-
Notifications
You must be signed in to change notification settings - Fork 6k
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-op] Cleanup utils folder bazel dependency #49938
[core] [no-op] Cleanup utils folder bazel dependency #49938
Conversation
Signed-off-by: dentiny <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice lgtm, did you get get boost iostreams to work?
Yeah Jiajun helped me work out, the issue is we have two targets compiling pipe logger; one of them has the necessary dependency but the other one doesn't :( |
Signed-off-by: dentiny <[email protected]>
Signed-off-by: dentiny <[email protected]>
src/ray/core_worker/task_manager.cc
Outdated
@@ -1015,7 +1015,7 @@ bool TaskManager::RetryTaskIfPossible(const TaskID &task_id, | |||
// TODO(clarng): clean up and remove task_retry_delay_ms that is relied | |||
// on by some tests. | |||
int32_t delay_ms = task_failed_due_to_oom | |||
? ExponentialBackoff::GetBackoffMs( | |||
? ExponentialBackOff::GetBackoffMs( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's changed in this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
upper case and lower case.
@@ -1,44 +1,213 @@ | |||
load("//bazel:ray.bzl", "ray_cc_library") | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aslonnie is this file now follows bazel best practice? Need your expertise here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet, the followup PR is:
- Split the giant
utils
bazel target and depend what we use; - Split logging / filesystem dependency (should be an easy followup).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall seems fine. probably will be non-trivial to maintain this manually though.
it is the right thing to do to have fine-grained bazel build rules to have the best build performance. in the long run, we will need tools to auto maintain this build file based on static analysis of source files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the long run, we will need tools to auto maintain this build file based on static analysis of source files.
I agree, in Nuro we have BUILD file auto-generation so I never need to hand-write bazel file;
I checked some open source tools like gazelle, but none of them seem to support C++; if you could help me with that I would be much grateful!
src/ray/util/exponential_backoff.h
Outdated
uint64_t Next() { | ||
auto ret = curr_value_; | ||
curr_value_ = curr_value_ * multiplier_; | ||
curr_value_ = std::min(curr_value_, max_value_); | ||
return ret; | ||
} | ||
|
||
uint64_t Current() { return curr_value_; } | ||
|
||
void Reset() { curr_value_ = initial_value_; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we split unifying ExponentialBackoff to a separate PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ray_cc_library( | ||
name = "util", | ||
srcs = glob( | ||
[ | ||
"*.cc", | ||
], | ||
exclude = [ | ||
"*_test.cc", | ||
], | ||
), | ||
hdrs = glob([ | ||
"*.h", | ||
]), | ||
linkopts = select({ | ||
"@platforms//os:windows": [], | ||
"//conditions:default": ["-lpthread"], | ||
}), | ||
name = "visibility", | ||
hdrs = ["visibility.h"], | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are these single header libraries? are they actually just header-only libraries?
this will not even generate object files. I think there are also bazel rules that are cc_headers
for headers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand, but it's common to have header-only targets.
For example, abseil one: https://github.com/abseil/abseil-cpp/blob/3735766b3bd68522c8f291675df3fddb4bc3c70d/absl/base/BUILD.bazel
deps = [ | ||
":thread_checker", | ||
"//:aligned_alloc", | ||
"//:sha256", | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is this :thread_checker
defined? I do not seem to find it in this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 216 to 221 in 8ba3ffa
ray_cc_library( | |
name = "thread_checker", | |
hdrs = ["thread_checker.h"], | |
srcs = ["thread_checker.cc"], | |
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well for missing dependency issue, we should trust the compiler and CI
deps = [ | ||
":array", | ||
":container_util", | ||
":counter_map", | ||
":event", | ||
":event_label", | ||
":exponential_backoff", | ||
":function_traits", | ||
":logging", | ||
":macros", | ||
":memory", | ||
":process", | ||
":random", | ||
":sample", | ||
":sequencer", | ||
":string_utils", | ||
":timestamp_utils", | ||
":throttler", | ||
":thread_utils", | ||
":type_traits", | ||
":visibility", | ||
"//:sha256", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah.. this feels a bit wrong.. that a util library depends on so many other libs here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's written this way for target compatibility, otherwise I have to manually update a thousand files.
As I mentioned here, it's worth another PR to further cleanup the util target dependency.
@@ -1,44 +1,213 @@ | |||
load("//bazel:ray.bzl", "ray_cc_library") | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall seems fine. probably will be non-trivial to maintain this manually though.
it is the right thing to do to have fine-grained bazel build rules to have the best build performance. in the long run, we will need tools to auto maintain this build file based on static analysis of source files.
We have two exponential backoff class, one with `Off` in uppercase, another one with `off` in lowercase, which is confusion; and I think it doesn't make sense to have two classes serving strongly relavent feature. This PR is originally part of the refactor PR, suggested by @jjyao to make a separate one. Refactor PR for reference: #49938 Jiajun's comment: #49938 (comment) --------- Signed-off-by: dentiny <[email protected]>
We have two exponential backoff class, one with `Off` in uppercase, another one with `off` in lowercase, which is confusion; and I think it doesn't make sense to have two classes serving strongly relavent feature. This PR is originally part of the refactor PR, suggested by @jjyao to make a separate one. Refactor PR for reference: ray-project#49938 Jiajun's comment: ray-project#49938 (comment) --------- Signed-off-by: dentiny <[email protected]> Signed-off-by: Jimmy Xie <[email protected]>
We have two exponential backoff class, one with `Off` in uppercase, another one with `off` in lowercase, which is confusion; and I think it doesn't make sense to have two classes serving strongly relavent feature. This PR is originally part of the refactor PR, suggested by @jjyao to make a separate one. Refactor PR for reference: ray-project#49938 Jiajun's comment: ray-project#49938 (comment) --------- Signed-off-by: dentiny <[email protected]> Signed-off-by: Jimmy Xie <[email protected]>
Signed-off-by: dentiny <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Signed-off-by: dentiny <[email protected]>
We have two exponential backoff class, one with `Off` in uppercase, another one with `off` in lowercase, which is confusion; and I think it doesn't make sense to have two classes serving strongly relavent feature. This PR is originally part of the refactor PR, suggested by @jjyao to make a separate one. Refactor PR for reference: ray-project#49938 Jiajun's comment: ray-project#49938 (comment) --------- Signed-off-by: dentiny <[email protected]> Signed-off-by: Anson Qian <[email protected]>
Signed-off-by: dentiny <[email protected]> Signed-off-by: Anson Qian <[email protected]>
Motivation: @jjyao was helping debugging a boost dependency issue, and found for some of the util targets are built twice since they were included in two targets.
The best practice for using bazel is to define bazel targets for each translation unit (for C++), and only wrap a few translation units when (1) they're usually used together; (2) they have interdependency.
This PR split the giant util target into smaller targets, so next time we could , and should include a clear single target.
it includes some dependency cleanup and apply IWYU, overall a no-op change.