Repository: ray-project/ray
Pull request #52285: [core] Place object_manager bazel targets into separate directories
Author: login: Ziy1-Tan
Labels: name: core
description: Issues that should be addressed in Ray Core
name: go
description: add ONLY when ready to merge, run all tests
name: community-contribution
description: Contributed by the community
name: community-backlog
Created: 2025-04-13T07:56:28Z | Merged: 2025-04-23T21:43:08Z

<!-- Thank you for your contribution! Please review https://github.com/ray-project/ray/blob/master/CONTRIBUTING.rst before opening a pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR. If you don't have the access to it, we will shortly find a reviewer and assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this solves. -->

## Related issue number

Closes #52268 

## Checks

- [x] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR.
- [x] 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 added any new APIs to the API Reference. For example, if I added a
           method in Tune, I've added it in `doc/source/tune/api/` under the
           corresponding `.rst` file.
- [x] 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
   - [x] Unit tests
   - [ ] Release tests
   - [ ] This PR is not tested :(


Linked issue #52268: [core] Place object_manager targets into separate directories
Subissue of the #51969 

Diff:
diff --git a/BUILD.bazel b/BUILD.bazel
index dfc3792bd6c1..04a93c2ef70e 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -311,7 +311,7 @@ ray_cc_library(
     ],
     deps = [
         ":grpc_common_lib",
-        ":object_manager_grpc_stub_manager",
+        "//src/ray/object_manager:object_manager_grpc_stub_manager",
         ":object_manager_cc_grpc",
         "//src/ray/common:asio",
         "//src/ray/common:status",
@@ -562,8 +562,8 @@ ray_cc_library(
         "//src/ray/common:id",
         "//src/ray/common:ray_object",
         "//src/ray/gcs/gcs_client:gcs_client_lib",
-        ":object_manager_common",
-        ":object_directory",
+        "//src/ray/object_manager:object_manager_common",
+        "//src/ray/object_manager:object_directory",
         "//src/ray/pubsub:subscriber_lib",
         ":worker_pool",
         ":worker_rpc",
@@ -607,7 +607,8 @@ ray_cc_library(
         ":local_object_manager",
         ":node_manager_fbs",
         ":node_manager_rpc",
-        ":object_manager",
+        "//src/ray/object_manager:object_manager",
+        "//src/ray/object_manager:ownership_object_directory",
         "//src/ray/pubsub:pubsub_lib",
         ":raylet_agent_manager",
         ":runtime_env_agent_client",
@@ -675,106 +676,6 @@ ray_cc_test(
     ],
 )
 
-ray_cc_test(
-    name = "pull_manager_test",
-    size = "small",
-    srcs = [
-        "src/ray/object_manager/test/pull_manager_test.cc",
-    ],
-    tags = ["team:core"],
-    deps = [
-        ":pull_manager",
-        "//src/ray/common:test_util",
-        "@com_google_googletest//:gtest_main",
-    ],
-)
-
-ray_cc_test(
-    name = "object_buffer_pool_test",
-    size = "small",
-    srcs = [
-        "src/ray/object_manager/test/object_buffer_pool_test.cc",
-    ],
-    tags = ["team:core"],
-    deps = [
-        ":object_buffer_pool",
-        "@com_google_googletest//:gtest_main",
-    ],
-)
-
-ray_cc_test(
-    name = "ownership_based_object_directory_test",
-    size = "small",
-    srcs = [
-        "src/ray/object_manager/test/ownership_based_object_directory_test.cc",
-    ],
-    tags = ["team:core"],
-    deps = [
-        ":ownership_based_object_directory",
-        ":ray_mock",
-        "@com_google_googletest//:gtest_main",
-    ],
-)
-
-ray_cc_test(
-    name = "push_manager_test",
-    size = "small",
-    srcs = [
-        "src/ray/object_manager/test/push_manager_test.cc",
-    ],
-    tags = ["team:core"],
-    deps = [
-        ":raylet_lib",
-        "//src/ray/common:test_util",
-        "@com_google_googletest//:gtest_main",
-    ],
-)
-
-ray_cc_test(
-    name = "spilled_object_test",
-    size = "small",
-    srcs = [
-        "src/ray/object_manager/test/spilled_object_test.cc",
-    ],
-    tags = ["team:core"],
-    deps = [
-        ":raylet_lib",
-        "@boost//:endian",
-        "//src/ray/common:test_util",
-        "@com_google_absl//absl/strings:str_format",
-        "@com_google_googletest//:gtest_main",
-    ],
-)
-
-
-ray_cc_test(
-    name = "create_request_queue_test",
-    size = "small",
-    srcs = [
-        "src/ray/object_manager/test/create_request_queue_test.cc",
-    ],
-    tags = ["team:core"],
-    deps = [
-        "//src/ray/object_manager/plasma:plasma_store_server_lib",
-        "@com_google_googletest//:gtest",
-        "@com_google_googletest//:gtest_main",
-    ],
-)
-
-ray_cc_test(
-    name = "get_request_queue_test",
-    size = "small",
-    srcs = [
-        "src/ray/object_manager/test/get_request_queue_test.cc",
-    ],
-    tags = ["team:core"],
-    deps = [
-        "//src/ray/object_manager/plasma:plasma_store_server_lib",
-        "@com_google_googletest//:gtest",
-        "@com_google_googletest//:gtest_main",
-    ],
-)
-
 ray_cc_test(
     name = "worker_pool_test",
     size = "small",
@@ -948,178 +849,6 @@ ray_cc_test(
     ],
 )
 
-ray_cc_library(
-    name = "object_manager",
-    srcs = ["src/ray/object_manager/object_manager.cc"],
-    hdrs = ["src/ray/object_manager/object_manager.h"],
-    deps = [
-        ":chunk_object_reader",
-        ":object_buffer_pool",
-        ":object_directory",
-        ":object_manager_common",
-        ":object_manager_rpc",
-        ":ownership_based_object_directory",
-        ":pull_manager",
-        ":push_manager",
-        "//src/ray/common:asio",
-        "//src/ray/common:id",
-        "//src/ray/common:ray_config",
-        "//src/ray/common:status",
-        "//src/ray/object_manager/plasma:plasma_store_server_lib",
-        "//src/ray/protobuf:common_cc_proto",
-        "//src/ray/protobuf:node_manager_cc_proto",
-        "@boost//:asio",
-        "@boost//:bind",
-        "@com_google_absl//absl/container:flat_hash_map",
-        "@com_google_absl//absl/container:flat_hash_set",
-        "@com_google_absl//absl/time",
-    ],
-)
-
-ray_cc_library(
-    name = "push_manager",
-    srcs = ["src/ray/object_manager/push_manager.cc"],
-    hdrs = ["src/ray/object_manager/push_manager.h"],
-    deps = [
-        "//src/ray/stats:stats_metric",
-        "//src/ray/common:id",
-        "//src/ray/common:ray_config",
-        "//src/ray/common:status",
-        "//src/ray/util",
-        "@com_google_absl//absl/container:flat_hash_map",
-        "@com_google_absl//absl/container:flat_hash_set",
-    ],
-)
-
-ray_cc_library(
-    name = "pull_manager",
-    srcs = ["src/ray/object_manager/pull_manager.cc"],
-    hdrs = ["src/ray/object_manager/pull_manager.h"],
-    deps = [
-        ":object_manager_rpc",
-        ":ownership_based_object_directory",
-        "//src/ray/stats:stats_metric",
-        "//src/ray/common:id",
-        "//src/ray/common:ray_config",
-        "//src/ray/common:ray_object",
-        "//src/ray/common:status",
-        "//src/ray/util:container_util",
-        "//src/ray/util:counter_map",
-        "@boost//:asio",
-        "@boost//:bind",
-        "@com_google_absl//absl/container:flat_hash_map",
-        "@com_google_absl//absl/container:flat_hash_set",
-        "@com_google_absl//absl/time",
-    ],
-)
-
-ray_cc_library(
-    name = "ownership_based_object_directory",
-    srcs = ["src/ray/object_manager/ownership_based_object_directory.cc"],
-    hdrs = ["src/ray/object_manager/ownership_based_object_directory.h"],
-    deps = [
-        "//src/ray/gcs/gcs_client:gcs_client_lib",
-        ":object_directory",
-        "//src/ray/pubsub:subscriber_lib",
-        ":worker_rpc",
-        "//src/ray/common:asio",
-        "//src/ray/common:id",
-        "//src/ray/common:status",
-        "//src/ray/util:sequencer",
-        "@com_google_absl//absl/container:flat_hash_map",
-    ],
-)
-
-ray_cc_library(
-    name = "object_directory",
-    hdrs = ["src/ray/object_manager/object_directory.h"],
-    deps = [
-        "//src/ray/gcs/gcs_client:gcs_client_lib",
-        ":object_manager_common",
-        "//src/ray/common:asio",
-        "//src/ray/common:id",
-        "//src/ray/common:status",
-    ],
-)
-
-ray_cc_library(
-    name = "object_buffer_pool",
-    srcs = ["src/ray/object_manager/object_buffer_pool.cc"],
-    hdrs = ["src/ray/object_manager/object_buffer_pool.h"],
-    deps = [
-        ":memory_object_reader",
-        "//src/ray/common:id",
-        "//src/ray/common:status",
-        "//src/ray/util:logging",
-        "@boost//:asio",
-        "@boost//:bind",
-        "@com_google_absl//absl/base",
-        "@com_google_absl//absl/container:flat_hash_map",
-        "@com_google_absl//absl/synchronization",
-        "@com_google_absl//absl/time",
-    ],
-)
-
-ray_cc_library(
-    name = "object_manager_common",
-    srcs = ["src/ray/object_manager/common.cc"],
-    hdrs = ["src/ray/object_manager/common.h"],
-    deps = [
-        "//src/ray/common:id",
-        "//src/ray/common:ray_config",
-        "//src/ray/common:status",
-        "@boost//:asio",
-        "@com_google_absl//absl/strings",
-    ],
-)
-
-ray_cc_library(
-    name = "object_manager_grpc_stub_manager",
-    hdrs = ["src/ray/object_manager/grpc_stub_manager.h"],
-    deps = [
-        ":grpc_client",
-        "@com_github_grpc_grpc//:grpc++",
-    ],
-)
-
-ray_cc_library(
-    name = "memory_object_reader",
-    srcs = ["src/ray/object_manager/memory_object_reader.cc"],
-    hdrs = ["src/ray/object_manager/memory_object_reader.h"],
-    deps = [
-        ":object_reader",
-        "//src/ray/object_manager/plasma:plasma_client",
-    ],
-)
-
-ray_cc_library(
-    name = "chunk_object_reader",
-    srcs = ["src/ray/object_manager/chunk_object_reader.cc"],
-    hdrs = ["src/ray/object_manager/chunk_object_reader.h"],
-    deps = [
-        ":spilled_object_reader",
-        "//src/ray/util:logging",
-    ],
-)
-
-ray_cc_library(
-    name = "spilled_object_reader",
-    srcs = ["src/ray/object_manager/spilled_object_reader.cc"],
-    hdrs = ["src/ray/object_manager/spilled_object_reader.h"],
-    deps = [
-        ":object_reader",
-        "//src/ray/util:logging",
-        "@com_google_absl//absl/types:optional",
-        "@com_google_googletest//:gtest_prod",
-    ],
-)
-
-ray_cc_library(
-    name = "object_reader",
-    hdrs = ["src/ray/object_manager/object_reader.h"],
-    deps = ["//src/ray/protobuf:common_cc_proto"],
-)
-
 ray_cc_library(
     name = "platform_shims",
     srcs = [] + select({
diff --git a/src/ray/core_worker/BUILD.bazel b/src/ray/core_worker/BUILD.bazel
index 3027202bdacf..396efbc77b3f 100644
--- a/src/ray/core_worker/BUILD.bazel
+++ b/src/ray/core_worker/BUILD.bazel
@@ -458,11 +458,11 @@ ray_cc_library(
     srcs = ["experimental_mutable_object_manager.cc"],
     hdrs = ["experimental_mutable_object_manager.h"],
     deps = [
-        "//:object_manager_common",
         "//src/ray/common:ray_config",
         "//src/ray/common:ray_object",
         "//src/ray/common:status",
         "//src/ray/common:task_common",
+        "//src/ray/object_manager:object_manager_common",
         "//src/ray/object_manager/plasma:plasma_client",
         "@com_google_absl//absl/container:node_hash_map",
         "@com_google_absl//absl/strings",
diff --git a/src/ray/core_worker/experimental_mutable_object_manager.cc b/src/ray/core_worker/experimental_mutable_object_manager.cc
index 9c90dffbd182..38bb166f8e9c 100644
--- a/src/ray/core_worker/experimental_mutable_object_manager.cc
+++ b/src/ray/core_worker/experimental_mutable_object_manager.cc
@@ -14,6 +14,8 @@
 
 #include "ray/core_worker/experimental_mutable_object_manager.h"
 
+#include <fcntl.h>
+
 #include <memory>
 #include <string>
 #include <utility>
diff --git a/src/ray/core_worker/test/BUILD.bazel b/src/ray/core_worker/test/BUILD.bazel
index db8e184a9384..a76fa840337d 100644
--- a/src/ray/core_worker/test/BUILD.bazel
+++ b/src/ray/core_worker/test/BUILD.bazel
@@ -124,7 +124,6 @@ ray_cc_test(
     srcs = ["object_recovery_manager_test.cc"],
     tags = ["team:core"],
     deps = [
-        "//:object_manager_common",
         "//:ray_mock",
         "//src/ray/raylet_client:raylet_client_lib",
         "//src/ray/common:task_common",
@@ -132,6 +131,7 @@ ray_cc_test(
         "//src/ray/core_worker:memory_store",
         "//src/ray/core_worker:normal_task_submitter",
         "//src/ray/core_worker:object_recovery_manager",
+        "//src/ray/object_manager:object_manager_common",
         "@com_google_googletest//:gtest",
         "@com_google_googletest//:gtest_main",
     ],
@@ -334,9 +334,9 @@ ray_cc_test(
         "//conditions:default": ["@platforms//:incompatible"],
     }),
     deps = [
-        "//:object_manager_common",
         "//:ray_mock",
         "//src/ray/core_worker:experimental_mutable_object_provider",
+        "//src/ray/object_manager:object_manager_common",
         "//src/ray/object_manager/plasma:plasma_client",
         "//src/ray/object_manager/plasma:plasma_store_server_lib",
         "@com_google_absl//absl/functional:bind_front",
diff --git a/src/ray/object_manager/BUILD.bazel b/src/ray/object_manager/BUILD.bazel
new file mode 100644
index 000000000000..619e208c9df4
--- /dev/null
+++ b/src/ray/object_manager/BUILD.bazel
@@ -0,0 +1,161 @@
+load("//bazel:ray.bzl", "ray_cc_library")
+
+ray_cc_library(
+    name = "object_manager",
+    srcs = ["object_manager.cc"],
+    hdrs = ["object_manager.h"],
+    deps = [
+        "spilled_object_reader",
+        ":chunk_object_reader",
+        ":object_buffer_pool",
+        ":object_directory",
+        ":object_manager_common",
+        ":pull_manager",
+        ":push_manager",
+        "//:object_manager_rpc",
+        "//src/ray/common:asio",
+        "//src/ray/common:id",
+        "//src/ray/common:ray_config",
+        "//src/ray/common:status",
+        "//src/ray/object_manager/plasma:plasma_store_server_lib",
+        "//src/ray/protobuf:common_cc_proto",
+        "//src/ray/protobuf:node_manager_cc_proto",
+        "@com_google_absl//absl/container:flat_hash_map",
+    ],
+)
+
+ray_cc_library(
+    name = "push_manager",
+    srcs = ["push_manager.cc"],
+    hdrs = ["push_manager.h"],
+    deps = [
+        "//src/ray/common:id",
+        "//src/ray/stats:stats_metric",
+        "@com_google_absl//absl/container:flat_hash_map",
+    ],
+)
+
+ray_cc_library(
+    name = "pull_manager",
+    srcs = ["pull_manager.cc"],
+    hdrs = ["pull_manager.h"],
+    deps = [
+        ":object_manager_common",
+        ":ownership_object_directory",
+        "//:object_manager_rpc",
+        "//src/ray/common:id",
+        "//src/ray/common:ray_config",
+        "//src/ray/common:ray_object",
+        "//src/ray/common:status",
+        "//src/ray/stats:stats_metric",
+        "//src/ray/util:container_util",
+        "//src/ray/util:counter_map",
+        "@boost//:asio",
+        "@boost//:bind",
+        "@com_google_absl//absl/container:flat_hash_map",
+        "@com_google_absl//absl/container:flat_hash_set",
+        "@com_google_absl//absl/time",
+    ],
+)
+
+ray_cc_library(
+    name = "ownership_object_directory",
+    srcs = ["ownership_object_directory.cc"],
+    hdrs = ["ownership_object_directory.h"],
+    deps = [
+        ":object_directory",
+        "//:worker_rpc",
+        "//src/ray/common:asio",
+        "//src/ray/common:id",
+        "//src/ray/gcs/gcs_client:gcs_client_lib",
+        "//src/ray/pubsub:subscriber_lib",
+        "@com_google_absl//absl/container:flat_hash_map",
+    ],
+)
+
+ray_cc_library(
+    name = "object_directory",
+    hdrs = ["object_directory.h"],
+    deps = [
+        ":object_manager_common",
+        "//src/ray/common:asio",
+        "//src/ray/common:id",
+        "//src/ray/common:status",
+        "//src/ray/gcs/gcs_client:gcs_client_lib",
+    ],
+)
+
+ray_cc_library(
+    name = "object_buffer_pool",
+    srcs = ["object_buffer_pool.cc"],
+    hdrs = ["object_buffer_pool.h"],
+    deps = [
+        ":memory_object_reader",
+        "//src/ray/common:id",
+        "//src/ray/common:status",
+        "//src/ray/util:logging",
+        "@com_google_absl//absl/base",
+        "@com_google_absl//absl/container:flat_hash_map",
+        "@com_google_absl//absl/synchronization",
+        "@com_google_absl//absl/time",
+    ],
+)
+
+ray_cc_library(
+    name = "object_manager_common",
+    srcs = ["common.cc"],
+    hdrs = ["common.h"],
+    deps = [
+        "//src/ray/common:id",
+        "//src/ray/common:ray_config",
+        "//src/ray/common:status",
+        "@com_google_absl//absl/strings",
+    ],
+)
+
+ray_cc_library(
+    name = "object_manager_grpc_stub_manager",
+    hdrs = ["grpc_stub_manager.h"],
+    deps = [
+        "//:grpc_client",
+        "@com_github_grpc_grpc//:grpc++",
+    ],
+)
+
+ray_cc_library(
+    name = "memory_object_reader",
+    srcs = ["memory_object_reader.cc"],
+    hdrs = ["memory_object_reader.h"],
+    deps = [
+        ":object_reader",
+        "//src/ray/object_manager/plasma:plasma_client",
+    ],
+)
+
+ray_cc_library(
+    name = "chunk_object_reader",
+    srcs = ["chunk_object_reader.cc"],
+    hdrs = ["chunk_object_reader.h"],
+    deps = [
+        ":object_reader",
+        "//src/ray/util:logging",
+    ],
+)
+
+ray_cc_library(
+    name = "spilled_object_reader",
+    srcs = ["spilled_object_reader.cc"],
+    hdrs = ["spilled_object_reader.h"],
+    deps = [
+        ":object_reader",
+        "//src/ray/util:logging",
+        "@com_google_absl//absl/types:optional",
+        "@com_google_googletest//:gtest_prod",
+    ],
+)
+
+ray_cc_library(
+    name = "object_reader",
+    hdrs = ["object_reader.h"],
+    deps = ["//src/ray/protobuf:common_cc_proto"],
+)
diff --git a/src/ray/object_manager/chunk_object_reader.h b/src/ray/object_manager/chunk_object_reader.h
index 33b13474b530..097d2c84e863 100644
--- a/src/ray/object_manager/chunk_object_reader.h
+++ b/src/ray/object_manager/chunk_object_reader.h
@@ -17,7 +17,7 @@
 #include <memory>
 #include <string>
 
-#include "ray/object_manager/spilled_object_reader.h"
+#include "ray/object_manager/object_reader.h"
 
 namespace ray {
 
diff --git a/src/ray/object_manager/common.cc b/src/ray/object_manager/common.cc
index b8a96af11ce8..349ffbd8881f 100644
--- a/src/ray/object_manager/common.cc
+++ b/src/ray/object_manager/common.cc
@@ -14,7 +14,6 @@
 
 #include "ray/object_manager/common.h"
 
-#include <csignal>
 #include <string>
 
 #include "absl/strings/str_cat.h"
diff --git a/src/ray/object_manager/common.h b/src/ray/object_manager/common.h
index 32193229d9c3..7a790bc91275 100644
--- a/src/ray/object_manager/common.h
+++ b/src/ray/object_manager/common.h
@@ -19,7 +19,6 @@
 #endif
 
 #include <atomic>
-#include <boost/asio.hpp>
 #include <functional>
 #include <string>
 
diff --git a/src/ray/object_manager/object_buffer_pool.h b/src/ray/object_manager/object_buffer_pool.h
index 458f72122569..d780707be2a4 100644
--- a/src/ray/object_manager/object_buffer_pool.h
+++ b/src/ray/object_manager/object_buffer_pool.h
@@ -14,10 +14,6 @@
 
 #pragma once
 
-#include <boost/asio.hpp>
-#include <boost/asio/error.hpp>
-#include <boost/bind/bind.hpp>
-#include <list>
 #include <memory>
 #include <string>
 #include <utility>
diff --git a/src/ray/object_manager/object_manager.cc b/src/ray/object_manager/object_manager.cc
index 6101a20b0578..b6679aba539b 100644
--- a/src/ray/object_manager/object_manager.cc
+++ b/src/ray/object_manager/object_manager.cc
@@ -15,7 +15,6 @@
 #include "ray/object_manager/object_manager.h"
 
 #include <algorithm>
-#include <chrono>
 #include <memory>
 #include <string>
 #include <unordered_set>
@@ -23,9 +22,9 @@
 #include <vector>
 
 #include "ray/common/common_protocol.h"
-#include "ray/object_manager/plasma/store.h"
+#include "ray/object_manager/plasma/store_runner.h"
+#include "ray/object_manager/spilled_object_reader.h"
 #include "ray/stats/metric_defs.h"
-#include "ray/util/util.h"
 
 namespace asio = boost::asio;
 
diff --git a/src/ray/object_manager/object_manager.h b/src/ray/object_manager/object_manager.h
index 35d5906e83ac..6f5e7cc275c5 100644
--- a/src/ray/object_manager/object_manager.h
+++ b/src/ray/object_manager/object_manager.h
@@ -14,33 +14,20 @@
 
 #pragma once
 
-#include <algorithm>
-#include <boost/asio.hpp>
-#include <boost/asio/error.hpp>
-#include <boost/bind/bind.hpp>
 #include <cstdint>
-#include <deque>
-#include <map>
 #include <memory>
-#include <mutex>
-#include <random>
 #include <string>
 #include <thread>
 #include <vector>
 
 #include "absl/container/flat_hash_map.h"
-#include "absl/container/flat_hash_set.h"
-#include "absl/time/clock.h"
 #include "ray/common/asio/instrumented_io_context.h"
 #include "ray/common/id.h"
-#include "ray/common/ray_config.h"
 #include "ray/common/status.h"
 #include "ray/object_manager/chunk_object_reader.h"
 #include "ray/object_manager/common.h"
 #include "ray/object_manager/object_buffer_pool.h"
 #include "ray/object_manager/object_directory.h"
-#include "ray/object_manager/ownership_based_object_directory.h"
-#include "ray/object_manager/plasma/store_runner.h"
 #include "ray/object_manager/pull_manager.h"
 #include "ray/object_manager/push_manager.h"
 #include "ray/rpc/object_manager/object_manager_client.h"
diff --git a/src/ray/object_manager/ownership_based_object_directory.cc b/src/ray/object_manager/ownership_object_directory.cc
similarity index 99%
rename from src/ray/object_manager/ownership_based_object_directory.cc
rename to src/ray/object_manager/ownership_object_directory.cc
index 8db9791e80bc..0641a8a58525 100644
--- a/src/ray/object_manager/ownership_based_object_directory.cc
+++ b/src/ray/object_manager/ownership_object_directory.cc
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include "ray/object_manager/ownership_based_object_directory.h"
+#include "ray/object_manager/ownership_object_directory.h"
 
 #include <memory>
 #include <string>
diff --git a/src/ray/object_manager/ownership_based_object_directory.h b/src/ray/object_manager/ownership_object_directory.h
similarity index 99%
rename from src/ray/object_manager/ownership_based_object_directory.h
rename to src/ray/object_manager/ownership_object_directory.h
index a3ae48c563e4..870be8b5fc05 100644
--- a/src/ray/object_manager/ownership_based_object_directory.h
+++ b/src/ray/object_manager/ownership_object_directory.h
@@ -15,9 +15,7 @@
 #pragma once
 
 #include <memory>
-#include <mutex>
 #include <string>
-#include <unordered_map>
 #include <unordered_set>
 #include <utility>
 #include <vector>
@@ -31,7 +29,6 @@
 #include "ray/pubsub/subscriber.h"
 #include "ray/rpc/worker/core_worker_client.h"
 #include "ray/rpc/worker/core_worker_client_pool.h"
-#include "ray/util/sequencer.h"
 
 namespace ray {
 
diff --git a/src/ray/object_manager/plasma/BUILD.bazel b/src/ray/object_manager/plasma/BUILD.bazel
index 65aae5078753..99dcd98ab0ca 100644
--- a/src/ray/object_manager/plasma/BUILD.bazel
+++ b/src/ray/object_manager/plasma/BUILD.bazel
@@ -37,11 +37,11 @@ ray_cc_library(
         ":plasma_generated",
         ":plasma_malloc",
         ":plasma_shared_memory",
-        "//:object_manager_common",
         "//src/ray/common:asio",
         "//src/ray/common:ray_config",
         "//src/ray/common:ray_object",
         "//src/ray/common:status",
+        "//src/ray/object_manager:object_manager_common",
         "//src/ray/protobuf:common_cc_proto",
         "//src/ray/util",
         "//src/ray/util:compat",
@@ -99,13 +99,13 @@ ray_cc_library(
         ":plasma_get_request_queue",
         ":plasma_malloc",
         ":plasma_object_store",
-        "//:object_manager_common",
         "//src/ray/common:asio",
         "//src/ray/common:file_system_monitor",
         "//src/ray/common:id",
         "//src/ray/common:network",
         "//src/ray/common:ray_config",
         "//src/ray/common:status",
+        "//src/ray/object_manager:object_manager_common",
         "//src/ray/stats:stats_metric",
         "//src/ray/util",
         "@boost//:bind",
@@ -137,10 +137,10 @@ ray_cc_library(
         ":plasma_eviction_policy",
         ":plasma_object_store",
         ":stats_collector",
-        "//:object_manager_common",
         "//src/ray/common:asio",
         "//src/ray/common:id",
         "//src/ray/common:ray_config",
+        "//src/ray/object_manager:object_manager_common",
         "@com_google_absl//absl/container:flat_hash_set",
         "@com_google_absl//absl/time",
         "@com_google_googletest//:gtest_prod",
@@ -184,7 +184,7 @@ ray_cc_library(
         ":object_manager_plasma_common",
         ":plasma_allocator",
         ":plasma_object_store",
-        "//:object_manager_common",
+        "//src/ray/object_manager:object_manager_common",
     ],
 )
 
@@ -205,8 +205,8 @@ ray_cc_library(
     deps = [
         ":object_manager_plasma_common",
         ":plasma_generated",
-        "//:object_manager_common",
         "//src/ray/common:status",
+        "//src/ray/object_manager:object_manager_common",
         "//src/ray/protobuf:common_cc_proto",
         "@com_google_absl//absl/container:flat_hash_map",
     ],
@@ -219,8 +219,8 @@ ray_cc_library(
     deps = [
         ":plasma_allocator_interface",
         ":plasma_malloc",
-        "//:object_manager_common",
         "//src/ray/common:ray_config",
+        "//src/ray/object_manager:object_manager_common",
         "//src/ray/util:logging",
         "@com_google_absl//absl/types:optional",
     ],
@@ -233,9 +233,9 @@ ray_cc_library(
     deps = [
         ":object_manager_plasma_common",
         ":plasma_connection_protocol",
-        "//:object_manager_common",
         "//src/ray/common:file_system_monitor",
         "//src/ray/common:status",
+        "//src/ray/object_manager:object_manager_common",
         "@com_google_absl//absl/container:flat_hash_map",
     ],
 )
@@ -249,8 +249,8 @@ ray_cc_library(
     ],
     deps = [
         ":plasma_generated",
-        "//:object_manager_common",
         "//src/ray/common:id",
+        "//src/ray/object_manager:object_manager_common",
         "//src/ray/util:compat",
         "//src/ray/util:macros",
         "@boost//:asio",
@@ -278,10 +278,10 @@ ray_cc_library(
         ":fling",
         ":object_manager_plasma_common",
         ":plasma_generated",
-        "//:object_manager_common",
         "//src/ray/common:id",
         "//src/ray/common:network",
         "//src/ray/common:status",
+        "//src/ray/object_manager:object_manager_common",
         "//src/ray/protobuf:common_cc_proto",
         "//src/ray/util:compat",
         "//src/ray/util:logging",
diff --git a/src/ray/object_manager/plasma/test/BUILD.bazel b/src/ray/object_manager/plasma/test/BUILD.bazel
index 7c683d16207a..423cfac1a128 100644
--- a/src/ray/object_manager/plasma/test/BUILD.bazel
+++ b/src/ray/object_manager/plasma/test/BUILD.bazel
@@ -32,8 +32,8 @@ ray_cc_test(
     ],
     target_compatible_with = ["@platforms//os:linux"],
     deps = [
-        "//:object_manager_common",
         "//src/ray/core_worker:experimental_mutable_object_manager",
+        "//src/ray/object_manager:object_manager_common",
         "@com_google_googletest//:gtest_main",
     ],
 )
diff --git a/src/ray/object_manager/pull_manager.cc b/src/ray/object_manager/pull_manager.cc
index de4addbe9a3f..f91bff777782 100644
--- a/src/ray/object_manager/pull_manager.cc
+++ b/src/ray/object_manager/pull_manager.cc
@@ -21,6 +21,7 @@
 #include <vector>
 
 #include "ray/common/common_protocol.h"
+#include "ray/common/ray_config.h"
 #include "ray/stats/metric_defs.h"
 
 namespace ray {
diff --git a/src/ray/object_manager/pull_manager.h b/src/ray/object_manager/pull_manager.h
index 8a82ff004251..7cd7598fcb27 100644
--- a/src/ray/object_manager/pull_manager.h
+++ b/src/ray/object_manager/pull_manager.h
@@ -14,10 +14,6 @@
 
 #pragma once
 
-#include <boost/asio.hpp>
-#include <boost/asio/error.hpp>
-#include <boost/bind/bind.hpp>
-#include <map>
 #include <memory>
 #include <set>
 #include <string>
@@ -29,12 +25,8 @@
 #include "absl/container/flat_hash_set.h"
 #include "absl/time/clock.h"
 #include "ray/common/id.h"
-#include "ray/common/ray_config.h"
 #include "ray/common/ray_object.h"
-#include "ray/common/status.h"
-#include "ray/object_manager/ownership_based_object_directory.h"
-#include "ray/rpc/object_manager/object_manager_client.h"
-#include "ray/rpc/object_manager/object_manager_server.h"
+#include "ray/object_manager/common.h"
 #include "ray/util/container_util.h"
 #include "ray/util/counter_map.h"
 
diff --git a/src/ray/object_manager/push_manager.cc b/src/ray/object_manager/push_manager.cc
index db4ad470f141..0f09f7e193f4 100644
--- a/src/ray/object_manager/push_manager.cc
+++ b/src/ray/object_manager/push_manager.cc
@@ -18,9 +18,7 @@
 #include <string>
 #include <utility>
 
-#include "ray/common/common_protocol.h"
 #include "ray/stats/metric_defs.h"
-#include "ray/util/util.h"
 
 namespace ray {
 
diff --git a/src/ray/object_manager/push_manager.h b/src/ray/object_manager/push_manager.h
index 366e1063163c..30ddec08626b 100644
--- a/src/ray/object_manager/push_manager.h
+++ b/src/ray/object_manager/push_manager.h
@@ -14,17 +14,13 @@
 
 #pragma once
 
-#include <algorithm>
 #include <list>
 #include <memory>
 #include <string>
 #include <utility>
 
 #include "absl/container/flat_hash_map.h"
-#include "absl/container/flat_hash_set.h"
 #include "ray/common/id.h"
-#include "ray/common/ray_config.h"
-#include "ray/common/status.h"
 
 namespace ray {
 
diff --git a/src/ray/object_manager/test/BUILD.bazel b/src/ray/object_manager/test/BUILD.bazel
new file mode 100644
index 000000000000..033706790cd9
--- /dev/null
+++ b/src/ray/object_manager/test/BUILD.bazel
@@ -0,0 +1,97 @@
+load("//bazel:ray.bzl", "ray_cc_test")
+
+ray_cc_test(
+    name = "pull_manager_test",
+    size = "small",
+    srcs = [
+        "pull_manager_test.cc",
+    ],
+    tags = ["team:core"],
+    deps = [
+        "//src/ray/object_manager:pull_manager",
+        "@com_google_googletest//:gtest_main",
+    ],
+)
+
+ray_cc_test(
+    name = "object_buffer_pool_test",
+    size = "small",
+    srcs = [
+        "object_buffer_pool_test.cc",
+    ],
+    tags = ["team:core"],
+    deps = [
+        "//src/ray/object_manager:object_buffer_pool",
+        "@com_google_googletest//:gtest_main",
+    ],
+)
+
+ray_cc_test(
+    name = "ownership_object_directory_test",
+    size = "small",
+    srcs = [
+        "ownership_object_directory_test.cc",
+    ],
+    tags = ["team:core"],
+    deps = [
+        "//:ray_mock",
+        "//src/ray/object_manager:ownership_object_directory",
+        "@com_google_googletest//:gtest_main",
+    ],
+)
+
+ray_cc_test(
+    name = "push_manager_test",
+    size = "small",
+    srcs = [
+        "push_manager_test.cc",
+    ],
+    tags = ["team:core"],
+    deps = [
+        "//:raylet_lib",
+        "@com_google_googletest//:gtest_main",
+    ],
+)
+
+ray_cc_test(
+    name = "spilled_object_test",
+    size = "small",
+    srcs = [
+        "spilled_object_test.cc",
+    ],
+    tags = ["team:core"],
+    deps = [
+        "//:raylet_lib",
+        "@boost//:endian",
+        "@com_google_absl//absl/strings:str_format",
+        "@com_google_googletest//:gtest_main",
+    ],
+)
+
+ray_cc_test(
+    name = "create_request_queue_test",
+    size = "small",
+    srcs = [
+        "create_request_queue_test.cc",
+    ],
+    tags = ["team:core"],
+    deps = [
+        "//src/ray/object_manager/plasma:plasma_store_server_lib",
+        "@com_google_googletest//:gtest",
+        "@com_google_googletest//:gtest_main",
+    ],
+)
+
+ray_cc_test(
+    name = "get_request_queue_test",
+    size = "small",
+    srcs = [
+        "get_request_queue_test.cc",
+    ],
+    tags = ["team:core"],
+    deps = [
+        "//src/ray/object_manager/plasma:plasma_store_server_lib",
+        "@com_google_googletest//:gtest",
+        "@com_google_googletest//:gtest_main",
+    ],
+)
diff --git a/src/ray/object_manager/test/create_request_queue_test.cc b/src/ray/object_manager/test/create_request_queue_test.cc
index 48fce1282ce0..bf8d440337f7 100644
--- a/src/ray/object_manager/test/create_request_queue_test.cc
+++ b/src/ray/object_manager/test/create_request_queue_test.cc
@@ -20,7 +20,6 @@
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 #include "ray/common/status.h"
-#include "ray/util/filesystem.h"
 
 namespace plasma {
 
diff --git a/src/ray/object_manager/test/ownership_based_object_directory_test.cc b/src/ray/object_manager/test/ownership_object_directory_test.cc
similarity index 99%
rename from src/ray/object_manager/test/ownership_based_object_directory_test.cc
rename to src/ray/object_manager/test/ownership_object_directory_test.cc
index cbe9ad74ade5..a511db7fb28a 100644
--- a/src/ray/object_manager/test/ownership_based_object_directory_test.cc
+++ b/src/ray/object_manager/test/ownership_object_directory_test.cc
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include "ray/object_manager/ownership_based_object_directory.h"
+#include "ray/object_manager/ownership_object_directory.h"
 
 #include <deque>
 #include <memory>
diff --git a/src/ray/object_manager/test/pull_manager_test.cc b/src/ray/object_manager/test/pull_manager_test.cc
index 2171003231e2..86a727cb8bdf 100644
--- a/src/ray/object_manager/test/pull_manager_test.cc
+++ b/src/ray/object_manager/test/pull_manager_test.cc
@@ -23,7 +23,6 @@
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 #include "ray/common/common_protocol.h"
-#include "ray/common/test_util.h"
 
 namespace ray {
 
diff --git a/src/ray/object_manager/test/push_manager_test.cc b/src/ray/object_manager/test/push_manager_test.cc
index 8a101714e724..fc60b89da647 100644
--- a/src/ray/object_manager/test/push_manager_test.cc
+++ b/src/ray/object_manager/test/push_manager_test.cc
@@ -19,7 +19,6 @@
 #include "absl/container/flat_hash_map.h"
 #include "absl/container/flat_hash_set.h"
 #include "gtest/gtest.h"
-#include "ray/common/test_util.h"
 
 namespace ray {
 
diff --git a/src/ray/object_manager/test/spilled_object_test.cc b/src/ray/object_manager/test/spilled_object_test.cc
index 8f2fedb21e22..0ce297e46873 100644
--- a/src/ray/object_manager/test/spilled_object_test.cc
+++ b/src/ray/object_manager/test/spilled_object_test.cc
@@ -21,7 +21,6 @@
 
 #include "absl/strings/str_format.h"
 #include "gtest/gtest.h"
-#include "ray/common/test_util.h"
 #include "ray/object_manager/chunk_object_reader.h"
 #include "ray/object_manager/memory_object_reader.h"
 #include "ray/object_manager/spilled_object_reader.h"
diff --git a/src/ray/raylet/node_manager.cc b/src/ray/raylet/node_manager.cc
index 098538c2f3a7..bad89ddd50de 100644
--- a/src/ray/raylet/node_manager.cc
+++ b/src/ray/raylet/node_manager.cc
@@ -41,6 +41,7 @@
 #include "ray/common/task/task_common.h"
 #include "ray/common/task/task_spec.h"
 #include "ray/gcs/pb_util.h"
+#include "ray/object_manager/ownership_object_directory.h"
 #include "ray/raylet/format/node_manager_generated.h"
 #include "ray/raylet/scheduling/cluster_task_manager.h"
 #include "ray/raylet/worker_killing_policy.h"
diff --git a/src/ray/raylet/test/local_object_manager_test.cc b/src/ray/raylet/test/local_object_manager_test.cc
index fd3cf5ca9b27..9e7b5e486a48 100644
--- a/src/ray/raylet/test/local_object_manager_test.cc
+++ b/src/ray/raylet/test/local_object_manager_test.cc
@@ -28,7 +28,7 @@
 #include "ray/common/asio/instrumented_io_context.h"
 #include "ray/common/id.h"
 #include "ray/gcs/gcs_client/accessor.h"
-#include "ray/object_manager/ownership_based_object_directory.h"
+#include "ray/object_manager/ownership_object_directory.h"
 #include "ray/pubsub/subscriber.h"
 #include "ray/raylet/test/util.h"
 #include "ray/raylet/worker_pool.h"


Reviews:
user: login: dentiny
body: Thank you so much for cleaning up!
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-04-13T12:48:12Z
user: login: dentiny
body: Thanks for the help! Code change LGTM
CC @dayshah as well, we need to check windows/mac build before merge.
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-04-21T03:22:00Z
user: login: jjyao
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-22T19:54:29Z
user: login: Ziy1-Tan
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-23T00:05:35Z

Review comments:
diff_hunk: @@ -1,6 +1,7 @@
 # Must be first. Enables build:windows, build:linux, build:macos, build:freebsd, build:openbsd
 build --enable_platform_specific_config
-
+build --local_ram_resources=HOST_RAM*.7 --local_cpu_resources=4
+build --disk_cache=~/bazel-cache
path: .bazelrc
user: login: jjyao
body: Is this intentional?
created_at: 2025-04-22T19:54:29Z
author_association: CONTRIBUTOR
diff_hunk: @@ -1,6 +1,7 @@
 # Must be first. Enables build:windows, build:linux, build:macos, build:freebsd, build:openbsd
 build --enable_platform_specific_config
-
+build --local_ram_resources=HOST_RAM*.7 --local_cpu_resources=4
+build --disk_cache=~/bazel-cache
path: .bazelrc
user: login: Ziy1-Tan
body: Oops, I'll remove these. They are only used locally.
created_at: 2025-04-23T00:05:35Z
author_association: CONTRIBUTOR

PR comments:
user: login: Ziy1-Tan
created_at: 2025-04-13T12:27:12Z
body: PTAL @dentiny 
author_association: CONTRIBUTOR
user: login: dentiny
created_at: 2025-04-13T12:48:59Z
body: Just FYI, we have flaky test on dashboard these days, so might take longer to pass all CI; ping me when it passes, or you think failed tests irrelevant, thanks!
author_association: CONTRIBUTOR
user: login: Ziy1-Tan
created_at: 2025-04-16T05:49:06Z
body: Hey, @dentiny . The ci is ok :)
author_association: CONTRIBUTOR
user: login: dentiny
created_at: 2025-04-16T07:11:38Z
body: I just enabled windows and mac test for you --- we've met some nasty platform specific prod issues these day, better to be more careful. Ping me when green.
author_association: CONTRIBUTOR
user: login: Ziy1-Tan
created_at: 2025-04-18T13:42:02Z
body: @dentiny , Ci is green now :)
author_association: CONTRIBUTOR
user: login: Ziy1-Tan
created_at: 2025-04-21T03:12:15Z
body: @edoakes / @aslonnie / @jjyao could you please help merge this pr? Thanks!
author_association: CONTRIBUTOR
user: login: jjyao
created_at: 2025-04-21T17:42:58Z
body: Triggered windows test.
author_association: CONTRIBUTOR
user: login: jjyao
created_at: 2025-04-21T19:16:00Z
body: ```
[2025-04-21T18:53:06Z] //src/ray/object_manager/test:ownership_based_object_directory_test      FAILED in 3 out of 3 in 0.1s
```

Maybe the target name is too long for Windows? cc @dayshah 
author_association: CONTRIBUTOR
user: login: dayshah
created_at: 2025-04-21T19:21:52Z
body: > ```
> [2025-04-21T18:53:06Z] //src/ray/object_manager/test:ownership_based_object_directory_test      FAILED in 3 out of 3 in 0.1s
> ```
> 
> Maybe the target name is too long for Windows? cc @dayshah

```
ERROR: src/main/native/windows/util.cc(262): GetShortPathNameW(\\?\C:\raytmp\6w7zvoxv\execroot\com_github_ray_project_ray\bazel-out\x64_windows-opt\bin\src\ray\object_manager\test\ownership_based_object_directory_test.exe.runfiles\com_github_ray_project_ray\src\ray\object_manager\test\ownership_based_object_directory_test.exe): cannot shorten the path enough
```

yup @Ziy1-Tan Can you change the name of the test and related source files to `ownership_object_directory`.
author_association: CONTRIBUTOR