-
Notifications
You must be signed in to change notification settings - Fork 7k
[core] Creating non-linux implementation for sysfs_cgroup_driver. #56483
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
Changes from 6 commits
17cfe41
092d05f
0299912
1a6bf2b
6691cf1
83de3f4
57ed34d
1a5f92f
e94393f
436811f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| """Some utility class for Collectives.""" | ||
| import logging | ||
| import asyncio | ||
| import logging | ||
|
|
||
| import ray | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| // 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 <string> | ||
| #include <unordered_set> | ||
|
|
||
| #include "ray/common/cgroup2/sysfs_cgroup_driver.h" | ||
| #include "ray/common/status.h" | ||
| #include "ray/common/status_or.h" | ||
|
|
||
| namespace ray { | ||
| Status SysFsCgroupDriver::CheckCgroupv2Enabled() { return Status::OK(); } | ||
|
|
||
| Status SysFsCgroupDriver::CheckCgroup(const std::string &cgroup_path) { | ||
| return Status::OK(); | ||
| } | ||
|
|
||
| Status SysFsCgroupDriver::CreateCgroup(const std::string &cgroup_path) { | ||
| return Status::OK(); | ||
| } | ||
|
|
||
| Status SysFsCgroupDriver::DeleteCgroup(const std::string &cgroup_path) { | ||
| return Status::OK(); | ||
| } | ||
|
|
||
| StatusOr<std::unordered_set<std::string>> SysFsCgroupDriver::GetAvailableControllers( | ||
| const std::string &cgroup_dir) { | ||
| return std::unordered_set<std::string>{}; | ||
| } | ||
|
|
||
| StatusOr<std::unordered_set<std::string>> SysFsCgroupDriver::GetEnabledControllers( | ||
| const std::string &cgroup_dir) { | ||
| return std::unordered_set<std::string>{}; | ||
| } | ||
|
|
||
| Status SysFsCgroupDriver::MoveAllProcesses(const std::string &from, | ||
| const std::string &to) { | ||
| return Status::OK(); | ||
| } | ||
|
|
||
| Status SysFsCgroupDriver::EnableController(const std::string &cgroup_path, | ||
| const std::string &controller) { | ||
| return Status::OK(); | ||
| } | ||
|
|
||
| Status SysFsCgroupDriver::DisableController(const std::string &cgroup_path, | ||
| const std::string &controller) { | ||
| return Status::OK(); | ||
| } | ||
|
|
||
| Status SysFsCgroupDriver::AddConstraint(const std::string &cgroup_path, | ||
| const std::string &controller, | ||
| const std::string &constraint, | ||
| const std::string &constraint_value) { | ||
| return Status::OK(); | ||
| } | ||
|
|
||
| StatusOr<std::unordered_set<std::string>> SysFsCgroupDriver::ReadControllerFile( | ||
| const std::string &controller_file_path) { | ||
| return std::unordered_set<std::string>{}; | ||
| } | ||
|
|
||
| } // namespace ray |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,8 +13,10 @@ | |
| // limitations under the License. | ||
| #pragma once | ||
|
|
||
| #include <linux/magic.h> | ||
| #include <mntent.h> | ||
| // TODO(#54703): SysFsCgroupDriver should not be a public target. | ||
| // It will be hidden behind a CgroupManagerFactory which will create | ||
| // an appropriate depending on configuration and platform. | ||
| // #include <mntent.h> | ||
|
|
||
| #include <string> | ||
| #include <unordered_set> | ||
|
|
@@ -24,12 +26,6 @@ | |
| #include "ray/common/status.h" | ||
| #include "ray/common/status_or.h" | ||
|
|
||
| // Used to identify if a filesystem is mounted using cgroupv2. | ||
| // See: https://docs.kernel.org/admin-guide/cgroup-v2.html#mounting | ||
| #ifndef CGROUP2_SUPER_MAGIC | ||
| #define CGROUP2_SUPER_MAGIC 0x63677270 | ||
| #endif | ||
|
|
||
| namespace ray { | ||
|
|
||
| /** | ||
|
|
@@ -51,7 +47,7 @@ class SysFsCgroupDriver : public CgroupDriverInterface { | |
| * | ||
| * @param mount_file_path only used for testing. | ||
| */ | ||
| explicit SysFsCgroupDriver(std::string mount_file_path = MOUNTED) | ||
| explicit SysFsCgroupDriver(std::string mount_file_path = kMountFilePath) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it was
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch! I've deleted the comments and changed it to
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, the relevant integration tests are introduced in a later PR. This would break tests in #56352. |
||
| : mount_file_path_(std::move(mount_file_path)) {} | ||
|
|
||
| ~SysFsCgroupDriver() override = default; | ||
|
|
@@ -280,5 +276,6 @@ class SysFsCgroupDriver : public CgroupDriverInterface { | |
| static constexpr std::string_view kCgroupSubtreeControlFilename = | ||
| "cgroup.subtree_control"; | ||
| static constexpr std::string_view kCgroupControllersFilename = "cgroup.controllers"; | ||
| static inline std::string kMountFilePath = "/mnt/mtab"; | ||
| }; | ||
| } // namespace ray | ||
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.
Moved here to make the header file support non-linux systems.