fix(spurd): remove dead code and wire cgroup cleanup#157
Merged
shiv-tyagi merged 1 commit intoROCm:mainfrom May 7, 2026
Merged
fix(spurd): remove dead code and wire cgroup cleanup#157shiv-tyagi merged 1 commit intoROCm:mainfrom
shiv-tyagi merged 1 commit intoROCm:mainfrom
Conversation
Remove superseded functions from executor.rs (job_execution_loop, report_completion, signal_job, run_epilog) and the unused create_server helper from agent_server.rs. Drop the never-read job_id field from RunningJob variants and the test-only which() utility from container.rs. Wire cleanup_cgroup into the agent server's monitor loop so cgroup directories are properly removed when jobs finish. Clean up all unused imports and prefix intentionally-unused parameters with underscore.
There was a problem hiding this comment.
Pull request overview
This PR removes superseded/dead code in the spurd agent implementation and wires job cgroup cleanup into the agent’s monitoring loop so cgroup directories are removed when jobs finish.
Changes:
- Removed unused helpers/fields (executor loop stubs,
RunningJob.job_id,agent_server::create_server,container::which()+ tests) and cleaned up unused imports/params. - Exposed and invoked cgroup cleanup from the agent server’s job monitor loop on job completion.
- Minor housekeeping in GPU/Landlock modules (unused imports, intentionally-unused parameter naming).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
crates/spurd/src/reporter.rs |
Removes unused imports after resource reporting refactors. |
crates/spurd/src/landlock.rs |
Removes unused warn import. |
crates/spurd/src/gpu.rs |
Removes unused warn import and marks an unused parameter. |
crates/spurd/src/executor.rs |
Deletes dead executor-loop code, removes RunningJob.job_id, adds take_cgroup, and makes cleanup_cgroup callable from the agent server. |
crates/spurd/src/container.rs |
Removes the test-only which() helper and its tests. |
crates/spurd/src/agent_server.rs |
Drops unused server helper and wires cgroup cleanup into the completion/monitor loop. |
Comments suppressed due to low confidence (1)
crates/spurd/src/executor.rs:542
cleanup_cgrouponly reads/kills PIDs fromcgroup.procsin the current cgroup. In cgroup v2,cgroup.procsdoes not include processes in descendant cgroups, so jobs that create nested cgroups can leave processes running and prevent successful removal. Consider usingcgroup.killwhen available, or recursively walking child cgroups to kill theircgroup.procsbefore attempting removal.
// Kill any remaining processes
if let Ok(pids) = std::fs::read_to_string(cgroup_path.join("cgroup.procs")) {
for pid_str in pids.lines() {
if let Ok(pid) = pid_str.trim().parse::<i32>() {
let _ = signal::kill(Pid::from_raw(pid), Signal::SIGKILL);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
8564376 to
178046e
Compare
Member
Author
|
Addressed the copilot review comments. Should be okay to merge now. The other things raised by copilot should be done in a separate PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Remove superseded functions from executor.rs (job_execution_loop, report_completion, signal_job, run_epilog) and the unused create_server helper from agent_server.rs. Drop the never-read job_id field from RunningJob variants and the test-only which() utility from container.rs.
Wire cleanup_cgroup into the agent server's monitor loop so cgroup directories are properly removed when jobs finish. Clean up all unused imports and prefix intentionally-unused parameters with underscore.