Skip to content
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

Cleanup running containers on the Control-C signal #422

Merged

Conversation

ammernico
Copy link
Member

  • Add the signal feature to tokio to interrupt and handle the Control-C signal in Butido.
  • Add Control-C signal handling into the Orchestrator.
  • Implement Drop on the JobHandle to ensure container cleanup.

This is a working draft pr for testing purposes and still missing some features.

@christophprokop
Copy link
Collaborator

Tested while multiple containers were running on all build hosts.
All containeres were successfully stopped after just a few seconds.
Nice! :)

@christophprokop christophprokop added the prerelease PRs which are merged to staging branch but not in main/master label Oct 1, 2024
@primeos-work primeos-work linked an issue Oct 7, 2024 that may be closed by this pull request
@ammernico ammernico marked this pull request as ready for review October 14, 2024 09:42
@ammernico ammernico force-pushed the container-cleanup branch 2 times, most recently from 284f396 to 752d2fc Compare October 14, 2024 13:17
Copy link
Member

@primeos-work primeos-work left a comment

Choose a reason for hiding this comment

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

I haven't done any testing yet but already found some potential issues in the code.

src/endpoint/scheduler.rs Outdated Show resolved Hide resolved
src/endpoint/scheduler.rs Outdated Show resolved Hide resolved
src/endpoint/scheduler.rs Outdated Show resolved Hide resolved
src/endpoint/scheduler.rs Outdated Show resolved Hide resolved
src/endpoint/scheduler.rs Outdated Show resolved Hide resolved
src/orchestrator/orchestrator.rs Outdated Show resolved Hide resolved
src/orchestrator/orchestrator.rs Outdated Show resolved Hide resolved
src/orchestrator/orchestrator.rs Show resolved Hide resolved
src/endpoint/scheduler.rs Show resolved Hide resolved
src/endpoint/scheduler.rs Outdated Show resolved Hide resolved
@ammernico ammernico force-pushed the container-cleanup branch 2 times, most recently from 4642a14 to 9e52a33 Compare November 13, 2024 12:40
@ammernico ammernico force-pushed the container-cleanup branch 2 times, most recently from 8bffd94 to 5a46550 Compare January 16, 2025 12:45
- Add the `signal` feature to `tokio` to interrupt and handle the
  Control-C signal in Butido.
- Add Control-C signal handling into the `Orchestrator`.
- Implement `Drop` on the `JobHandle` to ensure container cleanup.

Fixes science-computing#409

Signed-off-by: Nico Steinle <[email protected]>
Copy link
Member

@primeos-work primeos-work left a comment

Choose a reason for hiding this comment

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

The code LGTM now. Thanks!

@@ -69,7 +69,8 @@ shiplift = "0.7"
syntect = "5"
tar = "0.4"
terminal_size = "0.4"
tokio = { version = "1", features = ["macros", "fs", "process", "io-util", "time"] }
tokio = { version = "1", features = ["macros", "fs", "process", "io-util", "signal", "time"] }
tokio-util = "0.7"
Copy link
Member

Choose a reason for hiding this comment

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

Nit: This breaks the alphabetical ordering in the file.

src/endpoint/scheduler.rs Show resolved Hide resolved
src/orchestrator/orchestrator.rs Show resolved Hide resolved
@christophprokop christophprokop added this pull request to the merge queue Jan 16, 2025
@christophprokop christophprokop removed this pull request from the merge queue due to a manual request Jan 16, 2025
Copy link
Collaborator

@christophprokop christophprokop left a comment

Choose a reason for hiding this comment

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

Tested again.
Containers were stopped as expected.
Thanks!

@christophprokop christophprokop added this pull request to the merge queue Jan 16, 2025
Merged via the queue into science-computing:master with commit 106a4da Jan 16, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prerelease PRs which are merged to staging branch but not in main/master
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cleanup job for running containers
3 participants