@@ -113,65 +113,48 @@ StatusOr<std::unique_ptr<CgroupManager>> CgroupManager::Create(
113113 return cgroup_manager;
114114}
115115
116+ // TODO(#54703): This is a placeholder for cleanup. This will call
117+ // CgroupDriver::DeleteCgroup.
116118void CgroupManager::RegisterDeleteCgroup (const std::string &cgroup_path) {
117- cleanup_operations_.emplace_back ([this , cgroup = cgroup_path]() {
118- Status s = this ->cgroup_driver_ ->DeleteCgroup (cgroup);
119- if (!s.ok ()) {
120- RAY_LOG (WARNING) << absl::StrFormat (
121- " Failed to delete cgroup %s with error %s." , cgroup, s.ToString ());
122- }
119+ cleanup_operations_.emplace_back ([cgroup = cgroup_path]() {
120+ RAY_LOG (INFO) << absl::StrFormat (" Deleting all cgroup %s." , cgroup);
123121 });
124122}
125123
124+ // TODO(#54703): This is a placeholder for cleanup. This will call
125+ // CgroupDriver::MoveAllProcesses.
126126void CgroupManager::RegisterMoveAllProcesses (const std::string &from,
127127 const std::string &to) {
128- cleanup_operations_.emplace_back ([this , from_cgroup = from, to_cgroup = to]() {
129- Status s = this ->cgroup_driver_ ->MoveAllProcesses (from_cgroup, to_cgroup);
130- if (!s.ok ()) {
131- RAY_LOG (WARNING) << absl::StrFormat (
132- " Failed to move all processes from %s to %s with error %s" ,
133- from_cgroup,
134- to_cgroup,
135- s.ToString ());
136- }
128+ cleanup_operations_.emplace_back ([from_cgroup = from, to_cgroup = to]() {
129+ RAY_LOG (INFO) << absl::StrFormat (
130+ " Moved All Processes from %s to %s." , from_cgroup, to_cgroup);
137131 });
138132}
139133
134+ // TODO(#54703): This is a placeholder for cleanup. This will call
135+ // CgroupDriver::AddConstraint(cgroup, constraint, default_value).
140136template <typename T>
141137void CgroupManager::RegisterRemoveConstraint (const std::string &cgroup,
142138 const Constraint<T> &constraint) {
143139 cleanup_operations_.emplace_back (
144- [this , constrained_cgroup = cgroup, constraint_to_remove = constraint]() {
145- std::string default_value = std::to_string (constraint_to_remove.default_value_ );
146- Status s = this ->cgroup_driver_ ->AddConstraint (constrained_cgroup,
147- constraint_to_remove.controller_ ,
148- constraint_to_remove.name_ ,
149- default_value);
150- if (!s.ok ()) {
151- RAY_LOG (WARNING) << absl::StrFormat (
152- " Failed to set constraint %s=%s to default value for cgroup %s with error "
153- " %s." ,
154- constraint_to_remove.name_ ,
155- default_value,
156- constrained_cgroup,
157- s.ToString ());
158- }
140+ [constrained_cgroup = cgroup, constraint_to_remove = constraint]() {
141+ RAY_LOG (INFO) << absl::StrFormat (
142+ " Setting constraint %s to default value %lld for cgroup %s" ,
143+ constraint_to_remove.name_ ,
144+ constraint_to_remove.default_value_ ,
145+ constrained_cgroup);
159146 });
160147}
161148
162- void CgroupManager::RegisterDisableController (const std::string &cgroup_path,
149+ // TODO(#54703): This is a placeholder for cleanup. This will call
150+ // CgroupDriver::DisableController.
151+ void CgroupManager::RegisterDisableController (const std::string &cgroup,
163152 const std::string &controller) {
164- cleanup_operations_.emplace_back (
165- [this , cgroup = cgroup_path, controller_to_disable = controller]() {
166- Status s = this ->cgroup_driver_ ->DisableController (cgroup, controller_to_disable);
167- if (!s.ok ()) {
168- RAY_LOG (WARNING) << absl::StrFormat (
169- " Failed to disable controller %s for cgroup %s with error %s" ,
170- controller_to_disable,
171- cgroup,
172- s.ToString ());
173- }
174- });
153+ cleanup_operations_.emplace_back ([cgroup_to_clean = cgroup,
154+ controller_to_disable = controller]() {
155+ RAY_LOG (INFO) << absl::StrFormat (
156+ " Disabling controller %s for cgroup %s." , controller_to_disable, cgroup_to_clean);
157+ });
175158}
176159
177160Status CgroupManager::Initialize (int64_t system_reserved_cpu_weight,
@@ -185,11 +168,11 @@ Status CgroupManager::Initialize(int64_t system_reserved_cpu_weight,
185168 cpu_weight_constraint_.Max () - system_reserved_cpu_weight;
186169
187170 RAY_LOG (INFO) << absl::StrFormat (
188- " Initializing CgroupManager at base cgroup at '%s' . Ray's cgroup "
189- " hierarchy will under the node cgroup at '%s' . The %s controllers will be "
171+ " Initializing CgroupManager at base cgroup path at %s . Ray's cgroup "
172+ " hierarchy will under the node cgroup %s . The %s controllers will be "
190173 " enabled. "
191- " The system cgroup at '%s' will have constraints [%s=%lld, %s=%lld]. "
192- " The application cgroup '%s' will have constraints [%s=%lld]." ,
174+ " System cgroup %s will have constraints [%s=%lld, %s=%lld]. "
175+ " Application cgroup %s will have constraints [%s=%lld]." ,
193176 base_cgroup_path_,
194177 node_cgroup_path_,
195178 supported_controllers,
0 commit comments