Skip to content
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
28 changes: 27 additions & 1 deletion src/ray/common/cgroup2/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,33 @@ ray_cc_library(
}),
)

# Private Targets.
# Private targets
#
# TODO(#54703): This target builds the noop implementations.
# There's a corressponding test that runs on Linux and Non-Linux
# CI so breakages are caught in premerge before these targets are
# cleaned up at the end of the resource isolation milestone 1
# project.
Comment on lines +82 to +88
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel we don't really need this given we are very close to remove the noop thing and I'm sure you won't miss it anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I plan on deleting this in a few more PRs. I added it so I don't accidentally break CI again with 11/n and 12/n.

ray_cc_library(
name = "noop_cgroup_targets",
srcs = [
"noop_cgroup_manager.cc",
"noop_sysfs_cgroup_driver.cc",
],
hdrs = [
"cgroup_manager.h",
"scoped_cgroup_operation.h",
"sysfs_cgroup_driver.h",
],
visibility = [":__subpackages__"],
deps = [
":cgroup_driver_interface",
":cgroup_manager_interface",
"//src/ray/common:status",
"//src/ray/common:status_or",
],
)

ray_cc_library(
name = "fake_cgroup_driver",
hdrs = [
Expand Down
5 changes: 5 additions & 0 deletions src/ray/common/cgroup2/noop_cgroup_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,9 @@ StatusOr<std::unique_ptr<CgroupManager>> CgroupManager::Create(
return std::unique_ptr<CgroupManager>(
new CgroupManager(base_cgroup_path, node_id, std::move(cgroup_driver)));
}

Status CgroupManager::AddProcessToSystemCgroup(const std::string &pid) {
return Status::OK();
}

} // namespace ray
5 changes: 5 additions & 0 deletions src/ray/common/cgroup2/noop_sysfs_cgroup_driver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,9 @@ StatusOr<std::unordered_set<std::string>> SysFsCgroupDriver::ReadControllerFile(
return std::unordered_set<std::string>{};
}

Status SysFsCgroupDriver::AddProcessToCgroup(const std::string &cgroup,
const std::string &process) {
return Status::OK();
}

} // namespace ray
17 changes: 17 additions & 0 deletions src/ray/common/cgroup2/tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,20 @@ ray_cc_test(
"@com_google_googletest//:gtest_main",
],
)

# TODO(#54703): This target builds the noop implementations.
# There's a corressponding test that runs on Linux and Non-Linux
# CI so breakages are caught in premerge before these targets are
# cleaned up at the end of the resource isolation milestone 1
# project.
ray_cc_test(
name = "noop_cgroup_test",
srcs = ["noop_cgroup_test.cc"],
tags = [
"team:core",
],
deps = [
"//src/ray/common/cgroup2:noop_cgroup_targets",
"@com_google_googletest//:gtest_main",
],
)
31 changes: 31 additions & 0 deletions src/ray/common/cgroup2/tests/noop_cgroup_test.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2025 The Ray Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include <memory>
#include <utility>

#include "gtest/gtest.h"
#include "ray/common/cgroup2/cgroup_manager.h"
#include "ray/common/cgroup2/sysfs_cgroup_driver.h"
#include "ray/common/status.h"
namespace ray {

TEST(NoopCgroupTest, NoopCgroupDriverAndManagerBuildSuccessfullyOnAllPlatforms) {
std::unique_ptr<SysFsCgroupDriver> sysfs_cgroup_driver =
std::make_unique<SysFsCgroupDriver>();
auto cgroup_manager =
CgroupManager::Create("", "", 1, 1, std::move(sysfs_cgroup_driver));
}

} // namespace ray